[Beta] Add EuiCollapsibleNavItem component#6904
Conversation
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6904/ |
f608b29 to
6537772
Compare
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6904/ |
6537772 to
37d0e91
Compare
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6904/ |
37d0e91 to
053e496
Compare
EuiCollapsibleNavItem component
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6904/ |
- Because of the potentially recursive nature of this component, splitting it up into multiple sub-components that differentiate styling by an `isSubItem` prop is the easiest way to go
- Full component work will come in later PR
053e496 to
15d74be
Compare
|
@ryankeairns - adding you as a design reviewer in case you see any last minute UI/UX issues with the component stories. As a quick heads up, mobile/responsive behavior isn't in this PR yet (going work on that / the docked popover behavior in the next PR). @breehall - adding you as an engineering reviewer. If you see any visual UI/UX issues definitely feel free to shout on that end as well of course, but in particular I'm looking for any thoughts you have on architecture and developer experience, in particular the props API from a consumers POV. For example, does the Also, I know there's a lot of lines in this PR - but I think they're mostly stories/snapshots/tests. Hopefully the actual source code/components themselves aren't too onerous to grok, although if they are, I definitely want that feedback as well! |
1d941ac to
e48f0f9
Compare
+ add component comment for future-proofing
e48f0f9 to
7272344
Compare
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6904/ |
1 similar comment
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6904/ |
breehall
left a comment
There was a problem hiding this comment.
This looks really good so far Cee! I just had one UI issue I found, but I really love the API for the items array. I think it's easy to compose and maintain.
For titles that have children and also a link, I really like that the accordion doesn't toggle when you select the link. Very small thing, but it can be really annoying so I'm glad to see this!
The styles, tests, and snapshots look great so far as well. We had a chance to talk about the circular dependency decision today and I'm glad we did because that context helped me understand this code more. Maybe this could be an opportunity (in the future) to document this component with its subcomponents to for easy understanding of how they work together.
| href={href} | ||
| rel={rel} | ||
| className={classes} | ||
| {...({ ...rest, ...linkProps } as any)} // EuiLink ExclusiveUnion shenanigans |
There was a problem hiding this comment.
That good 'ol exclusive union!
There was a problem hiding this comment.
hide_the_pain_harold.jpg
| /** | ||
| * Optional icon to render to the left of title content | ||
| */ | ||
| iconType?: IconType; |
There was a problem hiding this comment.
What do you think about adding an iconProps prop to allow consumers to change the size, color, etc. of the icon? I thought of this because we're allowing customizations the link and accordion props.
There was a problem hiding this comment.
Nice! I'm good with that! Also I think I mentioned this on Slack recently, I'll probably be renaming iconType to just icon.
| // This is an intentional circular dependency between the accordion & parent item display. | ||
| // EuiSideNavItem is purposely recursive to support any amount of nested sub items, | ||
| // and split up into separate files/components for better dev readability |
| items={[ | ||
| { title: 'Lorem ipsum', iconType: 'visMapRegion', href: '#' }, | ||
| { title: 'Consectetur cursus', iconType: 'visPie', href: '#' }, | ||
| { title: 'Ultricies tellus', iconType: 'visMetric', href: '#' }, | ||
| ]} | ||
| /> |
There was a problem hiding this comment.
I really like items API. It's very easy to compose and read! This is a big improvement from the composing EuiCollapsibleNav.
There was a problem hiding this comment.
Yay!! Thank you for that feedback, that's great to hear! ❤️🔥
| { ...args, title: 'Link with icon', href: '#', iconType: 'alert' }, | ||
| ]} | ||
| /> | ||
| <EuiCollapsibleNavItem |
There was a problem hiding this comment.
In this section, I'm noticing a very slight issue with tabbing. When tabbing through the menu, I'm noticing that the focus is shifted to the accordions inside of this section even when it's collapsed.
What I did: Tab all the way through the menu and when you get to Accordion with Nest Accordions section (collapsed), notice that it takes two tabs to focus on the next menu item.
Since it's collapsed as I'm tabbing, I would expect the focus to skip the child contents and jump to the next focusable item.
I'm not sure if this is something you want to address in this PR, or the next one coming up!
Screen.Recording.2023-07-19.at.2.04.42.PM.mov
There was a problem hiding this comment.
Looking into this now! This may be an issue with EuiAccordion itself - if so, I probably won't fix this in this PR but instead open up a follow-up issue to resolve later.
There was a problem hiding this comment.
Yep, it's reproducible on main:
https://codesandbox.io/s/withered-moon-hc3ft6?file=/demo.js
Basically the issue appears to be nested EuiAccordions, and only when initialIsOpen is set on the child/nested element. We essentially need check to see if the the accordion is in a visible/tabbable context before allowing it to set itself to tabIndex={0}.
Super awesome catch Bree! I'll look into a fix outside this PR like I mentioned.
There was a problem hiding this comment.
Awesome! Sounds like a plan!
- per recent team discussion on prop naming
breehall
left a comment
There was a problem hiding this comment.
Hey Cee, thanks for answering my questions / comments. It looks like everything has been addressed and plans have been made!
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6904/ |
ryankeairns
left a comment
There was a problem hiding this comment.
I ran the storybook and everything looked sharp.
I did not scrutinize the code closely, but a quick review looked good from the parts I am skilled to review ;)
I'm personally comfortable with it, esp given its Beta status.
|
Thanks y'all! 🚢 |
Summary
This PR sets up a new
EuiCollapsibleNavItemcomponent that follows the new nav redesign and UX outlined in #6759.This PR, as noted by the [Beta] label in the title, is not a complete feature in and of itself. However, I'm choosing to ship it to main for the following reasonns reasons:
QA
gh pr checkout 6904yarn storybook(may need toyarnbeforehand if you haven't run EUI locally in a while)General checklist
- [ ] Checked in mobileResponsive/mobile work isn't yet done, will be part of the next upcoming work where theEuiCollapsibleNavBetacomponent itself gets fleshed out moreand cypress testsChangelog & docs: Skipping this for now due to beta status & until we have something we're ready for all public consumers to use. Once all components are put together, we can deprecate the old component and update docs.
- [ ] A changelog entry exists and is marked appropriately- [ ] Props have proper autodocs (using@defaultif default values are missing) and playground toggles- [ ] Added documentationFigma: See linked issue with Figma URLs - will likely need to update EUI's Figma library after this work is all over
- [ ] Updated the Figma library counterpart