-
Notifications
You must be signed in to change notification settings - Fork 6.3k
feat(ui): add keydown event to the pod dropdown menu #20996
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
feat(ui): add keydown event to the pod dropdown menu #20996
Conversation
❗ Preview Environment undeploy from Bunnyshell failedSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
ee77d25
to
2eac281
Compare
@@ -656,13 +656,25 @@ export function renderResourceMenu( | |||
{items.map((item, i) => ( | |||
<li | |||
className={classNames('application-details__action-menu', {disabled: item.disabled})} | |||
tabIndex={0} |
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.
Why is it always 0? Should it be i
?
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.
tabindex="0"
means that the element should be focusable in sequential keyboard navigation, after any positive tabindex values. The focus navigation order of these elements is defined by their order in the document source.
onKeyDown={e => { | ||
if (e.keyCode === 13 || e.key === 'Enter') { | ||
e.stopPropagation(); | ||
if (!item.disabled) { |
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 the current button is disabled, I think it shouldn't receive focus. Maybe we should just skip it.🤔
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 is indeed the better way!
Looks good, just fix DCO. |
Signed-off-by: vivian.zhang <vivian.zhang@daocloud.io>
Signed-off-by: vivian.zhang <vivian.zhang@daocloud.io>
56bf1c7
to
7dba696
Compare
DCO has been fixed. |
Signed-off-by: vivian.zhang <vivian.zhang@daocloud.io>
Signed-off-by: vivian.zhang <vivian.zhang@daocloud.io> Signed-off-by: Kanika Rana <krana@redhat.com>
Signed-off-by: vivian.zhang <vivian.zhang@daocloud.io> Signed-off-by: Oliver Gondža <ogondza@gmail.com>
Signed-off-by: vivian.zhang <vivian.zhang@daocloud.io>
Signed-off-by: vivian.zhang <vivian.zhang@daocloud.io>
Add keydown event to the pod dropdown menu
Fixes #20829
Before: No response to pressing the tab menu after clicking an item in the pod menu
After: Click on an item in the pod menu and press menu focus
Action Details Focus:

Action Delete Focus:

Checklist: