Open leosdad opened 2 years ago
@leosdad Thanks for the report.
If you pass true
to disableInteractive
prop of Tooltip
, you can achieve the behaviour (Tooltip disappearing as soon as hovering stops).
Check out this codesandbox.
Maybe we should consider setting this prop to true
by default. What do you think?
cc @mnajdova @oliviertassinari @danilo-leal
See #22382
I would propose:
disableInteractive
default value"This proposal is a breaking change, we could consider it for v6 if we have enough evidence that it's the right thing to do. I was personally not convinced at 100% when @eps1lon did the change, but I don't think that we have enough evidence to support that it wasn't our best option. I recall also talking about this case specifically to @davidluhr a few days ago.
Hi, OP here. Thanks all for the responses and the workaround, although I can't test anything because I'm on vacation now. I'll comment further when I'm back. Cheers
@oliviertassinari
Did the renaming and the label. You want me to close the issue? Isn't it better to leave it open?
@oliviertassinari
Did the renaming and the label. You want me to close the issue? Isn't it better to leave it open?
Please don't. Need to test the workaround first and maybe suggest a couple of changes to the docs. I'll be back in mid-February, I'll surely do it then. Thanks!
Related to this I think, but another use-case where this change in behavior is awkward. We use tooltips on tables to show truncated text, for better or worse, that can make for a lot of cells with a lot of potential tooltips. The new tooltip behavior breaks pretty badly since the tooltip overlays other cells and stops the user from interacting with them and getting at those tooltips. As for the AAA concerns, we address them in the underlying cell with aria-labels.
Also, the cell no longer has the aria-describedby or title attributes - though I'll admit we're still porting to v5 so this one might well be our bug.
See https://github.com/mui-org/material-ui/pull/22382 for why the current behavior is intended.
TL;DR: Changing the default value breaks WCAG level AA.
re. my previous comment about aria-describedby being missing, that was an issue with my code, the behavior change around describeChild
requires changes I'd not discovered (and aren't in the migration guide). Sorry, didn't mean to hijack issue.
@ggascoigne As far as I can tell, this issue is about interactive
/disableInteractive
which isn't related to the accessible name/accessible description. So if there's an issue with describeChild
, I would recommend opening a separate issue.
If you pass true to disableInteractive prop of Tooltip, you can achieve the behaviour (Tooltip disappearing as soon as hovering stops).
Yes, thanks! So in the end this wasn't a bug or an omission at all. Enabling it effectively solves my issue, but for some reason I missed it. My fault.
IMHO the word "interactive" would imply a hyperlink or a button. Perhaps "persistent" would be more descriptive. Also, a flag starting with 'disable' may be confusing.
Maybe we should consider setting this prop to true by default. What do you think?
I agree. IMHO that's what the Material Design guidelines say. Most implementations follow this too.
Anyway, thanks again for the solution to my problem.
I agree. IMHO that's what the Material Design guidelines say.
Could you quote and link this?
Most implementations follow this too.
That's not a reason to follow. With that reasoning we may just copy other component libraries and call it a day.
Also: What about the implementations that don't follow? Why is the a contest between the number of implementations for one or the other scenario? This issue isn't about popularity but accessibility.
Hi @eps1lon,
Could you quote and link this?
This link is above, here it is again: 'This is illustrated in the Material Design guidelines. Also, the statement "Continuously display the tooltip as long as the user long-presses or hovers over the element [my emphasis]." implies that when this is no longer the case the tooltip should disappear.'
That's not a reason to follow.
Agreed. It's just that MUI is where I found this behavior for the first time. But that's just my opinion, please do whatever you find is best.
Also please consider my suggestion to call this feature 'persistent' instead of 'interactive'. Inverting the logic to avoid 'disable' wouild also be nice. Again, just my 2 cents.
Thanks for your attention to this issue.
See #22382 for why the current behavior is intended.
TL;DR: Changing the default value breaks WCAG level AA.
I know I'm late to the discussion -- finally migrating our app from MUI 4 to 5 and ran into this. Your claim in the migration doc is incorrect (and I see @oliviertassinari and you were discussing back then), because WCAG 21 says "Examples of additional content controlled by the user agent include browser tooltips created through use of the HTML [title attribute]", so tooltips should not be interactive by default. Anyway, I did blanket search/replace, so easy. Thanks for all you hard work on MUI!!!
In all out projects with MUI, we disable it using theme provider https://mui.com/material-ui/customization/theme-components/#default-props
I think that the tooltip should be interactive if it is shown because of:
But the tooltip should have the default behaviour if opened via mouse hover.
Duplicates
Latest version
Current behavior π―
After a tooltip is shown, moving the mouse cursor over the tooltip keeps it open indefinitely. It is hidden only when the mouse cursor is moved outside it.
Expected behavior π€
The tooltip should close as soon as the mouse moves outside the main element. This is illustrated in the Material Design guidelines: Also, the statement "Continuously display the tooltip as long as the user long-presses or hovers over the element." implies that when this is no longer the case the tooltip should disappear.
See other Material Design implementations for comparison, e.g. Vue/Quasar), does it correctly:
Steps to reproduce πΉ
To reproduce:
Context π¦
Any context / all uses.
Your environment π
`npx @mui/envinfo`
``` Browser: MS Edge v. 97.0.1072.69, 64 bits System: OS: Windows 10 10.0.19042 Binaries: Node: 14.15.0 - C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 97.0.4692.99 Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.69) npmPackages: @emotion/react: ^11.7.1 => 11.7.1 @emotion/styled: ^11.6.0 => 11.6.0 @mui/base: 5.0.0-alpha.66 @mui/material: ^5.3.1 => 5.3.1 @mui/private-theming: 5.3.0 @mui/styled-engine: 5.3.0 @mui/system: 5.3.0 @mui/types: 7.1.0 @mui/utils: 5.3.0 @types/react: ^17.0.38 => 17.0.38 react: ^17.0.2 => 17.0.2 react-dom: ^17.0.2 => 17.0.2 ```