-
Notifications
You must be signed in to change notification settings - Fork 273
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(ui5-SegmentedButton): keyboard handling now compliant with the specification #3709
Conversation
packages/main/src/SegmentedButton.js
Outdated
} | ||
} | ||
|
||
_onPageUpOrDown(pageUpPressed) { |
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.
This function doesn't make the code more readable or structured. Better execute the code on place.
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.
Done
packages/main/src/SegmentedButton.js
Outdated
@@ -213,7 +218,25 @@ class SegmentedButton extends UI5Element { | |||
this._selectItem(event); | |||
} else if (isSpace(event)) { | |||
event.preventDefault(); | |||
} else if (isPageUp(event)) { | |||
event.preventDefault(); | |||
this._onPageUpOrDown(isPageUp(event)); |
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.
if you are already in this "if" block I think isPageUp(event) in "this._onPageUpOrDown(isPageUp(event))" is always true as already checked "else if (isPageUp(event)"
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.
Done
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.
The code now seems good to me.
Focus is moved on the first element of Segmented Button or last element via PageUp or PageDown keyboard key.
Related to: #3091