-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: pressing arrow keys behavior on Radio buttons #1138
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the previous implementation is a bit too hard to understand. I have rewritten it to make it easier to understand what each process does.
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -317,6 +317,8 @@ cases( | |
<input type="radio" name="" value="nameless2"/> | ||
<input type="radio" name="group" value="c" disabled/> | ||
<input type="radio" name="group" value="d"/> | ||
<input type="radio" name="group" value="e"/> | ||
<input type="radio" name="group" value="f"/> | ||
Comment on lines
+320
to
+321
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There were only two available radio buttons actually (the values are |
||
<input type="radio" name="foo"/> | ||
<input type="text" name="group"/> | ||
`, | ||
|
@@ -360,14 +362,14 @@ cases( | |
expectedTarget: '//input[@value="a"]', | ||
}, | ||
'forward around the corner': { | ||
focus: '//input[@value="d"]', | ||
focus: '//input[@value="f"]', | ||
key: 'ArrowRight', | ||
expectedTarget: '//input[@value="a"]', | ||
}, | ||
'backward around the corner': { | ||
focus: '//input[@value="a"]', | ||
key: 'ArrowUp', | ||
expectedTarget: '//input[@value="d"]', | ||
expectedTarget: '//input[@value="f"]', | ||
}, | ||
'do nothing on single radio': { | ||
focus: '//input[@name="solo"]', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the W3C specification about radio group describes, pressing the Down Arrow key behaves the same way as the Right Arrow key. "Moves focus to and checks the next radio button in the group" when the Down/Right arrow is pressed, so the
direction
ofwalkRadio
should be 1.The same is true for the Up and Left Arrow keys, so the
direction
should be -1.