-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Dashboard Usability] Change color of Unsaved changes badge to warning #154253
Conversation
Pinging @elastic/kibana-presentation (Team:Presentation) |
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.
We should update the text to match @KOTungseth's suggestion from the previous community PR - plus left a few nits, but nothing major :) Tested locally + code review. Will approve once the text is changed.
badges?: Array< | ||
EuiBadgeProps & { | ||
badgeText: string; | ||
toolTipProps: EuiToolTipProps; |
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.
nit: Might be nicer if this was of type Partial<EuiTooltipProps>
- that way, we could remove the as EuiToolTipProps
in dashboard_top_nav.tsx
<EuiToolTip {...toolTipProps}> | ||
<EuiBadge key={`nav-menu-badge-${i}`} {...badgeProps}> | ||
{badgeText} | ||
</EuiBadge> | ||
</EuiToolTip> |
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.
nit: Makes me nervous to always wrap every badge with an EuiTooltip
, since we're not the only consumer of the TopNavMenu
component.... I don't think any other implementation uses badges (searched quickly and couldn't find any), but I wonder if we want to make the toolTipProps
optional and conditionally wrap it?
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 also checked for any other consumers that use badges, but didn't see any. But I agree that tooltips could be optional for future consumers. I'm a little surprised tooltip
is not already an optional prop on EuiBadge
🤷 . Updated in fb3e1a0.
i18n.translate('dashboard.unsavedChangesBadgeToolTipContent', { | ||
defaultMessage: | ||
'This dashboard has changed since the last time it was saved. To clear this message save the dashboard.', | ||
}), |
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.
i18n.translate('dashboard.unsavedChangesBadgeToolTipContent', { | |
defaultMessage: | |
'This dashboard has changed since the last time it was saved. To clear this message save the dashboard.', | |
}), | |
i18n.translate('dashboard.unsavedChangesBadgeToolTipContent', { | |
defaultMessage: | |
'You have unsaved changes in this dashboard. To remove this label, save the dashboard.', | |
}), |
Source: #134696 (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.
Changes LGTM 🎉
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
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.
Awesome! LGTM
## Summary ### Before Since adding the tooltip to the unsaved changes badge in #154253, React was throwing an error to the console because the element in the top nav no longer had a unique key: https://user-images.githubusercontent.com/8698078/230927494-7cc931f8-68c6-4904-b99e-99b1b2872f94.mov <br> ![image](https://user-images.githubusercontent.com/8698078/230925422-32f8ea9d-8c22-470e-a94e-0aa9eda0b4de.png) ### After This PR fixes this by adding the key **to the tooltip** if the badge has one; if it doesn't have a tooltip, then the key is added directly to the `EuiBadge` as expected. It also ensures that the tooltip has the proper a11y support (cc @elastic/kibana-accessibility) by adding the badge to the tab order and using the <a href="https://github.com/elastic/eui/blob/main/wiki/component-design.md#pass-through-props">pass-through-props</a> to ensure that the tooltip shows up on focus: https://user-images.githubusercontent.com/8698078/230929396-5a423c18-4a5f-410c-a3d3-9005022f8060.mov ### Checklist - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
Summary
Change the color of the Unsaved changes badge to warning instead of success.
This also adds the ability for badges in the TopNavBar to have tooltips.
Includes changes from #134696
Fixes #133857