Skip to content

Fix the keyboard handling of a radio group - #360

Open
rezabakhshilaktasaraei wants to merge 3 commits into
desktop-app:masterfrom
rezabakhshilaktasaraei:radio-tab-focus
Open

Fix the keyboard handling of a radio group#360
rezabakhshilaktasaraei wants to merge 3 commits into
desktop-app:masterfrom
rezabakhshilaktasaraei:radio-tab-focus

Conversation

@rezabakhshilaktasaraei

Copy link
Copy Markdown
Contributor

Two fixes for the keyboard handling of a radio group, both in Radiobutton.

The roving Tab stop of the group was given Qt::StrongFocus, which also takes keyboard focus on a mouse click - a change for everyone, while all the group needs is to be reachable with Tab. Qt::TabFocus is what the rest of the accessibility code resolves its focusable widgets to, and it leaves the mouse behaviour alone.

The arrows move between the buttons along the axis the group is laid out on, found by comparing the position of a button with the one next to it. Those positions were read inside their parents, which works only while the buttons are siblings. The correct answer buttons of a quiz (Ui::FadeWrapScaled in create_poll_box), the rows of Settings > Privacy > Auto-delete messages and the premium gift options each put their button in a wrap of its own, at the same position inside it, so the group looked horizontal: Up / Down did nothing on a list of answers going down the box, while Left / Right moved through it. Comparing global positions fixes those and changes nothing where the buttons are siblings.

Verified with NVDA on Windows 10: in the quiz answers of a new poll the arrows now follow the list downwards and Left / Right are ignored, and the radio list of the self-destruct box, whose buttons are siblings, is unchanged.

The roving Tab stop of a radio group was given Qt::StrongFocus, which
also takes keyboard focus on a mouse click - a change for everyone,
while all the group needs is to be reachable with Tab. Qt::TabFocus is
what the rest of the accessibility code uses (RpWidget resolves its
focusable widgets to it), and it leaves the mouse behaviour alone.
The arrow keys move between the buttons of a radio group along the axis
the group is laid out on, found by comparing the position of a button
with the one next to it. Those positions were read inside their parents,
which works only while the buttons are siblings: the correct answer
buttons of a quiz sit in a wrap of their own each, at the same position
inside it, so the group looked horizontal and Up / Down did nothing on a
list of answers going down the box. Compare global positions instead.
The correct answer button of a quiz row is kept hidden until the row is
filled in, and it is still a member of the group - so Down from the last
shown button checked the hidden one, choosing an empty answer. Move on
to the next button that is shown and enabled instead, as Tab does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant