-
Notifications
You must be signed in to change notification settings - Fork 295
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(menu): add first version #1027
base: master
Are you sure you want to change the base?
Conversation
|
To get the ball roling, this would be a starting point: https://www.w3.org/TR/wai-aria-practices-1.2/#menu |
Hey, Looks like a great start, thanks for the contribution 💪 For a side project I was working on, I also needed some menus (as they are really missing in Lion atm) and I created an outline for that. It has quite some varying demos:
As someone who worked on the listbox (and its subclasses like select and combobox) quite a lot, I thought it would be possible to give them all a common ancestor wrt keyboard navigation: I did a study on all aria components (or at least that I know of) that are related as well and have common denominators (so tree views and toolbars as well) Common denominatorsWhat all components have in common:
MenusMenus are based on the following assumptions:
Work still requiredThis branch is by no means finished, so help here would be greatly appreciated 👍
Since this branch has demos for toolbar, tree, etc. I think it would be good to start off with just the menu component
(although we should keep in mind those other use cases, so we don't need to refactor our fundament later). About the apiI largely agreed with your api here and as discussed in the other issue (especially about nested menus, but made some changes on top: 1 level <button data-invoker>Open menu</button>
<lion-menu>
<div role="menuitem">Go to Definition</div>
<div role="menuitem">Go to Type Definition</div>
</lion-menu> multi level<nav>
<button data-invoker>Open menu</button>
<lion-menu>
<div role="menuitem">Go to Definition</div>
<div role="menuitem">Go to Type Definition</div>
<div>
<div role="menuitem" data-invoker>Peek</div>
<lion-menu>
<div role="menuitem">Peek Call Hierarchy</div>
<div role="separator"></div>
<div role="menuitem">Peek Definition</div>
</lion-menu>
</div>
<div role="separator"></div>
<div role="menuitem">Find all References</div>
</lion-menu>
</nav>
Everyone is free to comment on this api Btw: please feel free to say when you don’t like it or that it’s better to go in a different direction |
This PR is just a proposal, we can use your implementation if you are more advanced in the work. There was some discussion about API here: #903 In this discussion, we agreed to use another attribute for specifying the types of nodes. The Using listbox for navigation is not very useful since it's not selecting anything but I see in your use cases that you can select things too in menu. It's a common use case for applications but I didn't see this in ARIA Authoring Practices. We will need to adapt listbox to accept list with items that can't be selected (like the separators). I suppose it's better without the I see you have full menubar. I suppose we can create a menubar package containg a menubar and menu component or it can be 2 packages. |
Thanks. It would be awesome if you can elaborate on this of course 🙂 menubarThe menubar is behavior wise pretty close to the [role=menu] (except for role(menubar) and orientation I think), but we could indeed consider to make it a package. (toolbar and tree should definitely be their own packages, but here I'm fine with either one of the choices). api for itemsThe api is debatable indeed. Normally we create an abstraction on top of the roles, so the suggestion in #903 would be consistent with that choice. (difference here with normal is that now they would be 1-to-1 mappings, but holding on to this principle would also be nice) We would at least need to support the following roles:
And - because the generic mixin (called InteractiveListMixin, name may be changed) supports trees/listboxes/toolbars etc - the roles below as well:
bit more about overlay vs 'in page flow'Biggest implication of not always making menu an overlay would be to make it in such a way that it behaves like a disclosure/collapsible by default (think of loading a menu inside of a drawer), but will act as an overlay as soon as you apply the OverlayMixin. So again, feel free to contact us about that. proposed funcionality for menu packageI would propose that we start with a
|
The list of feature seems good to me :) It's a lot of feature, I don't know if we need to add all of theses features from the beginning. And I don't know if it will be easy to keep For the overlay, menu are generally with it but if you think we can make it without easily too, that's fine. Material Design define menus like that:
I don't know if "temporary surfaces" are always considered as in an overlay or not. |
Most of it is already there I think, but it needs to be polished, tested and rebased with master (which is also still some work). But let's find out together what makes sense for a first iteration. You can also do a proposal to change the scope.
Currently they are already managed by the menu component. I think they should not be advanced childs like checkbox and radio, which are form elements.
No clue what "temporary surfaces" means :) It suggests an overlay indeed, but then again a menubar is never an overlay. And also if you want to implement a drawer like in the Polymer docs (please make your screen width tablet/mobile size and open the drawer) you would place a 'disclosure menu' inside an overlay/drawer. |
@tlouisse Is there anything I can do on the code you've started to do with menus? I suppose this PR could be closed with your code. |
I miss the link of your branch in the long message you've posted. I will do PR targeting your branch if you are ok with that. |
@MathieuPuech sorry for the very late response. All due to the silly reason these github mails are automatically archived in Would you still be up to work on this? If so, I could reserve some time on short notice to rebase my branch with latest master, do some cleanup and explain the main ideas on that branch (https://github.com/ing-bank/lion/tree/feat/manyMenus) 👍 |
Yes, I can work on this, let me know when it's rebased and what can I do to help |
@MathieuPuech I spent half a day on this last weekend to get back into it again. Hopefully I can push something next weekend. |
This PR still needs some attention, maybe we can bring it back to live and finalise it soon! |
What I did
Need to add:
role
attributes