Skip to content
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

[EuiSelectable] add support for option tooltips #7715

Merged

Conversation

mgadewoll
Copy link
Contributor

@mgadewoll mgadewoll commented Apr 26, 2024

Summary

This is part 2 of #7690 (see part 1 here)
closes #7690

This PR updates EuiSelectable to support the two props toolTipContent and toolTipProps to be passed to EuiSelectable options to display a tooltip on hover/focus.

Screenshot 2024-04-26 at 15 35 01

QA

  • review and test EuiSelectable in storybook and docs and/or checkout this PR locally via gh pr checkout 7715
    • ensure the tooltip is applied as expected (on hover as well as on keyboard navigation or click)

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)

@mgadewoll mgadewoll marked this pull request as ready for review April 29, 2024 09:25
@mgadewoll mgadewoll requested a review from a team as a code owner April 29, 2024 09:25
@mgadewoll
Copy link
Contributor Author

🗒️ I added VRT snapshots to this PR but the initial state of the tooltip story is equal to the playground one.
We should add interactions to create a different state for Loki to snapshot, but I'd suggest to do it in a separate PR to keep things scoped. WDYT?

@cee-chen
Copy link
Contributor

cee-chen commented May 6, 2024

Hey Lene! I'm so sorry for not reviewing this in time for Monday's release - I'm leaning towards shipping with just the combobox tooltips for this week and getting selectable tooltips in next week if that's okay!

@mgadewoll
Copy link
Contributor Author

Hey Lene! I'm so sorry for not reviewing this in time for Monday's release - I'm leaning towards shipping with just the combobox tooltips for this week and getting selectable tooltips in next week if that's okay!

Of course, no worries - that's no problem! 🙂

cee-chen added 5 commits May 7, 2024 14:13
- my 2c: I don't think they cover anything the tests in `selectable_list_item.test.tsx` don't already cover
…ia-describedby`

- the `role="option"` should (I believe) go on the `<li>` element to be semantically correct
- we can tweak or manually inherit `aria-describedby` from the tooltip as necessary

- this also lets us remove an extra unnecessary `<span>` wrapper around the tooltips content
- move tooltip example to below truncation, as the options feel related (ways of handling excess information)

- make option examples/tooltip content more helpful and match combobox example

+ add link to EuiToolTip page and make props tab more specific
- fix error on keyboard up/down navigation of tooltip story - `enableFunctionToggleControls` has to only be set on the playground otherwise it throws an error because it's not included

- ts `as` cast cleanup
…ponent to a function component

- not sure if this is too extra, I found this easier to grok personally. If it feels too much for this PR, we can revert it or pull it out to a separate PR
@cee-chen
Copy link
Contributor

cee-chen commented May 8, 2024

@1Copenut I'll probably tag you in to test the screen reader experience of this tomorrow. It's working great for me on Firefox+VO but buggy for Safari+VO 😭 (it reads the tooltip description after moving away from the item on keyboard arrow navigation press, which is all kinds of weird)

@mgadewoll
Copy link
Contributor Author

@cee-chen Thanks for the changes! The updates look good to me 👍
I'm fine keeping the function component conversion in this PR - it's not part of the scope but it's a nice update anyway. One more step towards "no more class components" 🌈

Copy link
Contributor

@1Copenut 1Copenut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello team! I tested with five screen reader and browser combinations:

  • MacOS + Safari + VO
  • MacOS + Firefox + VO
  • Win10 + Firefox + NVDA
  • Win10 + Chrome + NVDA
  • Win10 + Chrome + JAWS

3 of 5 performed perfectly. The tooltips were announced as we expected, after the item name and a brief pause. There were two rough edges:

  1. JAWS + Chrome announces everything when you make a change like selecting or unselecting an item. So that means it announces the instructions, the item name, the item selection status, and the tooltip. This is the same as before, except the tooltip is added on. I would make mention of this fact in docs that too-long tooltips are a design rough edge and should be considered for in-page instruction.
  2. Safari + VoiceOver is very inconsistent announcing tooltips. It generally announces the tooltip that was removed from the DOM (IE, the previous item's tooltip). This is not great for the ~7% of screen reader users who make this their primary pairing. I pulled this data from the latest WebAIM Screen Reader Survey.

All in all, I don't have enough reservations to say this needs more work. The fact that Firefox + VO worked as expected has me thinking it's an issue in Safari more than VoiceOver.

@cee-chen
Copy link
Contributor

cee-chen commented May 9, 2024

Arggh. Thank you so much for confirming my findings Trevor, I was seeing that same behavior in Safari+VO as well.

Oh actually YOU KNOW WHAT. The baseline EuiSelectable component is doing this all by itself even without tooltips, what the heck. I can repro it in the production EUI docs right now: https://eui.elastic.co/#/forms/selectable

vo_bug

You can see it repeating the old/previous item that was navigated away from before it announces the next item, and it doesn't seem to announce the full current/next item or its state until after.

@1Copenut I think we need to file an issue for this separate from this PR, as something funky is definitely going on here even outside of tooltips.

I'm going to go ahead and merge this PR for now since the issue is with Safari/VO, but we should probably look into a fix separately 😬

Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🎉

@kibanamachine
Copy link

Preview staging links for this PR:

@cee-chen cee-chen merged commit 75750c5 into elastic:main May 9, 2024
5 checks passed
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tooltipContent and tooltipProps support for EuiComboBox and EuiSelectable options
5 participants