-
Notifications
You must be signed in to change notification settings - Fork 87
refactor: do not disable buttons when moving to overflow #9027
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
Conversation
737cd02
to
4ea0861
Compare
@@ -160,22 +143,6 @@ describe('overflow', () => { | |||
await nextResize(menu); | |||
|
|||
expect(buttons[0].getAttribute('tabindex')).to.equal('0'); | |||
expect(buttons[1].getAttribute('tabindex')).to.equal('-1'); |
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 check is not so relevant for the test, the actual thing is to ensure tabindex
is set to 0
on the first visible button (which had tabindex="-1"
before resizing above).
expect(buttons[1].getAttribute('tabindex')).to.equal('-1'); | ||
}); | ||
|
||
it('should set tabindex -1 on the overflow menu in tab navigation', async () => { |
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 a copy-paste of the test above. With tabNavigation
the logic for setting tabindex="0"
on the buttons that remain visible is not needed since all enabled buttons have tabindex="0"
by default. Removed the test.
cce9d1c
to
2590bd6
Compare
2590bd6
to
c22ba0c
Compare
|
Description
Depends on #8871
The original implementation sets
button.disabled = true
when hiding buttons and moving items to the overflow menu - see vaadin/vaadin-menu-bar#16 (comment). It was needed because back then the menu-bar used its own version of_getAvailableIndex()
that checked fordisabled
andhidden
attributes but not forvisibility
.Disabling is no longer needed since both Tab and arrow keys are now handled by
KeyboardDirectionMixin
which filters out hidden buttons usingisElementHidden()
and that helper checks forvisibility
property internally.Updated to not modify
disabled
on buttons manually so that it can be handled consistently via the Lit template, and modified the observer to call__renderButtons()
ondisabled
property change, the same as as on_theme
change.Also adjusted some tests to not check for
tabindex="-1"
set on the buttons that are moved to the overflow menu.This was a side-effect of setting
disabled
, in fact we don't need to not modifytabindex
for those buttons.Type of change