ScreenChooserDialog: make items keyboard-accessible & set Accessible.role
This MR contains two a11y-related changes:
The dialog for choosing a screen or window to share contains a CardLayout filled by a Repeater showing the screens or windows. This works for pointer-based interaction, but does not allow keyboard interaction; the cards function as buttons or checkboxes, but do not accept keyboard focus so cannot be reached through the tab chain.
This change registers the cards in the tab chain, and highlights the currently focused item.
The Cards for selecting screens or windows to share currently do not explicitly set an Accessible.role, and screen readers will not inform users about the type of control that they are interacting with.
This change sets the Accessible.role to Button for the Cards in single- selection dialogs (as activating them will immediately accept that selection, making it work like a button) and to CheckBox for multiple- selection dialogs, as activating them will only toggle the selected status, requiring the use of the Share button to complete the selection.
With this change, BUG 497971 should be fully fixed after frameworks/kirigami!1689 (merged) is merged.
Two notes:
- It would be nicer to have arrow-key navigation for the list, rather than only the tab chain. CardsLayout does not seem to make this easy though. Having keyboard navigation at all should be a definite improvement though, both for a11y and usability.
- I'm not sure how to test the multiple-select versions - xdg-portal-test-kde only seems to have the single-select version, and I don't know any app that uses it either. (OBS is referenced in the bug report, but also seems single-select only). Pointer would be appreciated.