Fix the keyboard handling of a radio group - #360
Open
rezabakhshilaktasaraei wants to merge 3 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.