-
Notifications
You must be signed in to change notification settings - Fork 83
feat(vertical-menu): implements updates required for Global Nav v2 #7298
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
0689c2c
to
630ef4f
Compare
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.
Good work @damienrobson-sage, overall happy with the approach and most comments I've left are non-blocking. I've also noticed an overflow issue (see below) and I've asked @harpalsingh and @tempertemper to clarify the keyboard behaviour as it seems when you open the submenu you are trapped in a loop between the parent and children items so i just want to clarify if that's correct.
src/components/vertical-menu/responsive-vertical-menu/__internal__/focus.context.tsx
Outdated
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/__internal__/focus.context.tsx
Outdated
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/__internal__/focus.context.tsx
Outdated
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/__internal__/focus.context.tsx
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/__internal__/focus.context.tsx
Show resolved
Hide resolved
...enu/responsive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.tsx
Outdated
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/responsive-vertical-menu.component.tsx
Outdated
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/responsive-vertical-menu.component.tsx
Outdated
Show resolved
Hide resolved
...enu/responsive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.tsx
Outdated
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/responsive-vertical-menu.test.tsx
Outdated
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/responsive-vertical-menu.component.tsx
Outdated
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/responsive-vertical-menu.component.tsx
Show resolved
Hide resolved
import { IncreaseDepth, useDepth } from "../__internal__/depth.context"; | ||
import { useMenuFocus } from "../__internal__/focus.context"; | ||
|
||
export interface ResponsiveVerticalMenuItemProps { |
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.
Does the styling match when they pass a Button
, wouldn't it just have the current Button
styling rather than look like an ResponsiveVerticalMenuItem
? There's also the scenario where they set an href
so the link/item is focusable but has a focusable Button child; admittedly that's up to the implementation teams to avoid if this approach is agreeable, but in MenuItem
we support passing href
and onClick
so that if they set both there's no WCAG violations etc
...sive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.component.tsx
Outdated
Show resolved
Hide resolved
...sive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.component.tsx
Outdated
Show resolved
Hide resolved
...sive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.component.tsx
Show resolved
Hide resolved
...sive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.component.tsx
Outdated
Show resolved
Hide resolved
...sive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.component.tsx
Outdated
Show resolved
Hide resolved
...sive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.component.tsx
Outdated
Show resolved
Hide resolved
...sive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.component.tsx
Outdated
Show resolved
Hide resolved
...sive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.component.tsx
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/__internal__/depth.context.tsx
Outdated
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/__internal__/depth.context.tsx
Outdated
Show resolved
Hide resolved
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.
Well done @damienrobson-sage on getting this done so well in such a short space of time, approach is spot on 👍
6c120ce
to
184353a
Compare
data-role="responsive-vertical-menu-expander-icon" | ||
depth={depth} | ||
expanded={expanded || isActive} | ||
reduceMotion={reducedMotion || false} |
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.
Looking at this does this need the || false
? The context/hook initialises it as false and I can't see anywhere where it could be set to anything that's not a boolean. If that's not the case then we could do the following to coerce it to a boolean etc
reduceMotion={!!reducedMotion}
src/components/vertical-menu/responsive-vertical-menu/responsive-vertical-menu.style.ts
Outdated
Show resolved
Hide resolved
src/components/vertical-menu/responsive-vertical-menu/responsive-vertical-menu.component.tsx
Outdated
Show resolved
Hide resolved
...sive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.component.tsx
Outdated
Show resolved
Hide resolved
...esponsive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.style.ts
Outdated
Show resolved
Hide resolved
184353a
to
c54548f
Compare
1a232f7
to
e7911d7
Compare
...ive-vertical-menu/responsive-vertical-menu-divider/responsive-vertical-menu-divider.style.ts
Outdated
Show resolved
Hide resolved
...esponsive-vertical-menu/responsive-vertical-menu-item/responsive-vertical-menu-item.style.ts
Outdated
Show resolved
Hide resolved
...ertical-menu/responsive-vertical-menu-divider/responsive-vertical-menu-divider.component.tsx
Outdated
Show resolved
Hide resolved
f788e06
to
11dd147
Compare
4b6fb05
to
3db94f1
Compare
5b7937e
to
42b3070
Compare
Keyboard behaviour working as intended so approving a11y review as well. |
Had a 2nd review with the scrollbars for responsive layout and happy with implementation, will review in the future to customise a visual for the darker layout. |
314a626
to
b04c85b
Compare
🎉 This PR is included in version 154.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Proposed behaviour
This PR adds a new component under Vertical Menu:
ResponsiveVerticalMenu
. This is a two-column menu which is powered by React's Context API and manages complex focus ordering and depth awareness. It is also responsive, switching to a modal sidebar whilst maintaining functionality and structure.Current behaviour
There is currently no vertical menu option available to consumers that supports complex menu structures with many items.
Checklist
d.ts
file added or updated if requiredQA
Testing instructions
A Storybook example has been provided under VerticalMenu > Responsive > Test that can be used to test the functionality.