-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Components: Add a generic navigable menu component #2989
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2989 +/- ##
==========================================
+ Coverage 34.38% 34.63% +0.24%
==========================================
Files 196 197 +1
Lines 5810 6153 +343
Branches 1027 1112 +85
==========================================
+ Hits 1998 2131 +133
- Misses 3222 3384 +162
- Partials 590 638 +48
Continue to review full report at Codecov.
|
Yep, for example when used for #2960 the word "Menu" wouldn't be so appropriate, since that's a toolbar. More importantly, ARIA roles need to be set properly. The DropDownMenu used Also, for a toolbar this component wouldn't be appropriate because a toolbar needs a |
This component is unopinionated, it doesn't enforce a role, the component using it has to set the roles itself. So it can be used for both toolbars and menus. I might consider adding a wrapper component |
Ok ok I was wrong, sorry :) Then in case of a toolbar |
I'm trying to finish my review, but I think there are some fundamental differences with how the DropDownMenu works that should be addressed. |
…wn menu to use it
ef3a7c2
to
56a46d3
Compare
Ok, I made some updates here to bring back the |
Tested a bit. Not sure why the table block uses the DropDown (which in turn uses the PopOver) and the Block switcher doesn't. Why they should look different? Seems to me they are functionally similar and they should look the same. Additionally, this introduces a difference in the behavior and focus management because the PopOver uses Also, this is what happens when I open the table block and then scroll the page with the trackpad: the PopOver stays fixed in its position, while the page scrolls: Trying to list the main issues I've noticed (please consider many of these things work nicely on the current DropDownMenu):
I'd recommend to check carefully what the current I understand the If there's the need to have some higher abstraction and more generic, reusable components, that's good but it shouldn't come at the cost of breaking what was already achieved. At the moment, I don't see why the current |
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.
Please see comment. At the moment I see an usability and accessibility regression here and there are a few things that should be addressed.
Note: my review refers to the PR state before the latest updates. |
The dropdownMenu is too opinionated, we can't add extra children (needed in the block switcher), I can add a prop to enable this but seems like a hack compared to reusing the lower level components
They don't look different for me, I'm not sure what you mean (you probably tested before my refactoring)
This is already tracked elsewhere #2999
Already implemented in DropdownMenu
I'd leave this out of this PR because it was added explicitely with its own issue/PR. This should be discusseed in the issue suggesting this.
You tested before my refactoring :)
It doesn't loop but it stays at the last position if no more items
done in the dropdown menu I won't focus on the changes to the BlockSwitcher in this PR, it's an improvment over master and the switcher won't be a similar dropdown menu with #2984 |
Looping and prevent default is fixed in df5ee5cc
yes 😬 I was writing the review while you pushed the updates, with a few minutes difference. The PR was in a pending review state, I'd expect to test something that doesn't change while testing 😉 Next time please try to inform me if updates are coming on a PR in a pending review state, I could have saved a few hours of testing and debugging...
About
this should be taken into consideration together with the fact that |
Can you explain why the |
Yes, sorry about this, I knew I had to do this refactoring after your first comment ;) |
I've just said "needs to be tested a bit". I'm not sure screen readers are able to announce an aria-label on an element that is not focusable. |
About the span with the "Transform into:" text, see #493 (comment) |
There's one thing left that worked on the Note: in the future we could possibly switch to the W3C model for this kind of widgets, where keyboard navigation inside the widget should work with arrow keys only and not with the Tab key. This should be discussed sooner or later :) |
I found that in several places, we'll have to create menus navigable using arrow keys. (toolbar, switcher ). I'm trying to extract this logic to a generic Navigable Menu Component.
I also dropped the DropdownMenu component which was not very reusable. (Tried and failed reusing it several times). It can be replaced with a combo
Dropdown
andNavigableMenu
The name of the component is probably not great, but I'm having a hard time finding a good name.
I'm using the component in the table block toolbar and in the block switcher dropdown. Could be used later for #2960
closes #696