-
Notifications
You must be signed in to change notification settings - Fork 840
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
[EuiCollapsibleNavBeta] Final collapsed/docked icon & popover behavior #7034
Conversation
- this isn't required by this PR, I just noticed it while working and wanted to clean up the className output of various sub-components to match their actual usage/component names
- `linkProps` should only be spread to actual EuiLink components, and not to the `span` - in reality, I'm not super sure how much of a difference this will make to consumers, but the upcoming collapsed nav item work will also behave this way and it's better to be consistent
- this may seem silly right now for just `EuiCollapsibleNavButton`, but it'll be needed by EuiCollapsibleNavBeta's children and grandchildren which we can't simply pass props directly to
- will be used by all top level items in collapsed/docked desktop state
- Similar to how `EuiCollapsibleNavAccordion` dogfoods `EuiCollapsibleNavLink`, this component dogfods `EuiCollapsedNavButton`
- which is a light wrapper similar to `EuiCollapsibleNavItemDisplay` that determines whether to render a nav component with or without items
- from both the nav toggle button and all docked button icons + fix missing `className`/`css` merging & tests on `EuiCollapsibleNavButton` - in theory EUI's the only ones using the component, but might as well make it flexible
- for mouse users, the cursor is still hovered over the button icon even when the popover is open, so the tooltip overlays on the popover title when it shouldn't - for keyboard users, this isn't an issue
Preview documentation changes for this PR: https://eui.elastic.co/pr_7034_buildkite/ |
- scrollbars that take up width (e.g. windows, mac setting) will cut too much into icon visibility otherwise. This CSS visually hides the scrollbars for all supported browsers while still allowing the containers to remain scrollable
113b497
to
f9838a3
Compare
euiCollapsibleNavButton: css` | ||
&.euiButtonIcon:hover { | ||
transform: none; | ||
} | ||
`, |
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 commit (965b476) was a request from Marcialis. I missed implementing it as part of the previous PR so figured I'd grab it in here.
The &.euiButtonIcon
specificity is unfortunately necessary to override EuiButtonicon's existing hover CSS.
// If the item has a popover and the popover is open, we don't want the | ||
// tooltip to appear if so - the popover already renders the item title | ||
hidden: css` | ||
display: none; | ||
`, |
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.
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.
Great catch!
/* This extra padding is needed for EuiPopovers to have enough | ||
space to render with the right anchorPosition */ | ||
${logicalCSS('padding-bottom', euiTheme.size.xs)} |
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.
isDesktopCollapsed: css` | ||
/* Hide the scrollbar for docked mode (while still keeping the nav scrollable) | ||
Otherwise if scrollbars are visible, button icon visibility suffers */ | ||
&, | ||
.euiFlyoutBody__overflow { | ||
scrollbar-width: none; /* Firefox */ | ||
|
||
&::-webkit-scrollbar { | ||
display: none; /* Chrome, Edge, & Safari */ | ||
} | ||
} | ||
`, |
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.
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.
Quick note - I just pushed up a naming refactor (a582ddc), but that should be my last set of changes / this PR is all ready to review after that :)
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.
Just want to note - I know this test (and dev tools) triggers this warning repeatedly:
I'm opting to skip it for now and tackle it in a separate accessibility PR/pass. The main reason it's actually not a major a11y issue is because of the wrapping EuiToolTip
, which sets an aria-describedby
on the button icon.
So the title will still get read out, albeit less quickly than an aria-label
would. But if I try to set an aria-label now, what happens is the title then gets repeated twice due to the tooltip describedby, which TBH feels worse. So I'd rather try to fix the issue more completely, hence the separate follow-up work.
Preview documentation changes for this PR: https://eui.elastic.co/pr_7034/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_7034_buildkite/ |
- I totally missed this in the Figma mocks 🥲
- instead of using `small`/`mobile`/`desktop`, use `push` vs `overlay` naming instead, which better describes what state the flyout is in - this matches the paradigm we want of container vs media queries - we should be describing how the *flyout* is behaving, not what size we think the user's screen is
81f63ba
to
a582ddc
Compare
Preview documentation changes for this PR: https://eui.elastic.co/pr_7034_buildkite/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_7034/ |
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 looks good overall. I spent a good amount of time with the collapse functionality and verifying across different screen sizes. The ability to navigate when the menu is collapsed (on desktop) is a nice touch!
[Consideration] I also spent some time with keyboard navigation. I know another PR for accessibility is coming down the line, but wanted to throw in this note. When the menu is collapsed and you're using the keyboard to navigate to the first item in the menu, it takes three tab
pressed to land there. I don't think this is the same as the tabbing issue we identified in the last PR because there are no children between the collapse button and the home item.
[Change request] It looks like the arrow states for the accordions are backwards. When the parent is collapsed, I believe the arrow should point down. When the parent is open, the parent should point up. I double checked with this with the Figma spec. I'm not sure how I missed that before, sorry about that!
const [isOverlay, setIsOverlay] = useState(false); | ||
const [isOverlayFullWidth, setIsOverlayFullWidth] = useState(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.
I like this change! It's very intuitive.
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.
Music to my ears!! 😁
.euiFlyoutBody { | ||
${logicalCSS('min-height', '50%')} | ||
} | ||
|
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 call on this. I toyed around by opening all of the toggles between the flyout body and footer. Hopefully no one would do this, but this is nice just in case.
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.
Haha, I remembered that one issue/bug report we got previously and tried to get ahead of it! :)
// If the item has a popover and the popover is open, we don't want the | ||
// tooltip to appear if so - the popover already renders the item title | ||
hidden: css` | ||
display: none; | ||
`, |
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.
Great catch!
🤦 You're totally right, thank you so much for catching that! 2a1ec67 |
Yep, great catch on this, I noticed the same thing. This behavior is a factor of several issues: Push flyouts in general have odd accessibility compared to non-push flyouts (see #6576), and also the All of the above are mediumly complex issues to resolve that I don't want to hold up Kibana's work for, since we can continue to work on them in the background and a11y fixes should Just Work later. 🤞 |
Preview documentation changes for this PR: https://eui.elastic.co/pr_7034_buildkite/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_7034/ |
💚 Build Succeeded
History
|
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.
Thank you for addressing my questions and flipping the accordion arrow!
Summary
EuiCollapsibleNavItem
component #6904, [EuiCollapsibleNavBeta] Build out component state and responsive behavior #7027This PR implements the final collapsed/docked behavior on desktop/wider screens:
<span>
will never be rendered, as tooltips require focusable anchors for accessibility.As always, there's a lot going on here and some commits specifically dedicated to cleaning up some things I missed in the previous PR, so follow along by commit!
QA
gh pr checkout 7034
yarn storybook
EuiCollapsedNavItem testing
icon
control and confirm it can be customizedicon
control and confirm it falls back to a 'boxes' iconhref
control and confirm the popover title is no longer a link / is a static spantitle
control to a really long string and confirm the popover title truncatesitems
object of all keys and confirm the popover disappears, and the icon (if empty) now falls back to a link iconisSelected
control and confirm a background color is appliedEuiCollapsibleNavBeta testing
General checklist
and cypress tests[ ] Checked for accessibility including keyboard-only and screenreader modesWhile this is an "okay" experience currently, it could certainly be better. I plan on doing a separate a11y polish pass PR after this, and looping in Trevor for his expertise.Skipping due to beta component status:
- [ ] A changelog entry exists and is marked appropriately- [ ] Checked for breaking changes and labeled appropriately- [ ] Props have proper autodocs (using@default
if default values are missing) and playground toggles- [ ] Added documentation- [ ] Checked Code Sandbox works for any docs examples- [ ] Updated the Figma library counterpart