-
Notifications
You must be signed in to change notification settings - Fork 68
[IMP] Menu: Delegate enabled to children items #7489
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
base: master
Are you sure you want to change the base?
Conversation
hokolomopo
left a comment
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.openingTimeOut.schedule(() => { | ||
| this.openSubMenu(menu, currentTarget); | ||
| }, TIMEOUT_DELAY); |
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.
I find it a bit strange UX-wise that the menu opens while there is a cursor: not-allowed and no hover/effect background. I'd remove the cursor and add back the hover effect for disabled parent menus
src/components/menu/menu.ts
Outdated
| if (children.length) { | ||
| const areChildrenEnabled = children.length |
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.
you check children.length twice
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.
can just write if(chidren.length) return children.some((child) => this.isEnabled(child));
| await simulateClick(".o-menu div[data-name='root']"); | ||
| expect(fixture.querySelector(".o-menu div[data-name='subMenu']")).toBeFalsy(); | ||
| }); | ||
| describe("'IsEnabled' is ignored on parent menu items", () => { |
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.
nitpick: don't use quotes in test names, we cannot use jest debugger then
Currently, if a menu is evaluated as disabled, we disable it and prevent the possibility to see its children by hover. However, there are some issues with this: - the user is mislead because we keep showing the arrow that suggest the presence of children items - the user can simply not navigate through the submenus to see what kind of feature could be available - if a menu has several children some of which are readonlyAllowed, then the readonlyAllowed condition has to be set on the parent as well; the 'enabling' condition therefore becomes a combination set on both the parent and children - if a parent menu is computed as 'enabled' it will not be greyed out (suggests that it has useful children) even if the said children are not enabled. This revision changes the computation of 'enabled' state of item by looking at the full tree of children and applies the following logic; A parent menu is disabled if every leaf of the tree is disabled. A single 'enabled' leaf (that is a child without children of its own) will make all its parent enabled as well, up to the root. We also allow all submenus to be opened regardless of the state of the parent. The user will therefore have a visual hint that there are active submenus or not (if all children are disabled, so will be the parent) and they will also have the possibility to have a look at all children to explore the possibilities. Task: 5331717
770b463 to
418f89c
Compare

Currently, if a menu is evaluated as disabled, we disable it and prevent the possibility to see its children by hover. However, there are some issues with this:
This revision changes the computation of 'enabled' state of item by looking at the full tree of children and applies the following logic; A parent menu is disabled if every leaf of the tree is disabled. A single 'enabled' leaf (that is a child without children of its own) will make all its parent enabled as well, up to the root. We also allow all submenus to be opened regardless of the state of the parent.
The user will therefore have a visual hint that there are active submenus or not (if all children are disabled, so will be the parent) and they will also have the possibility to have a look at all children to explore the possibilities.
Task: 5331717
Description:
description of this task, what is implemented and why it is implemented that way.
Task: TASK_ID
review checklist