-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Tooltip] Make interactive
default
#22382
Conversation
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.
Exception: The visual presentation of the additional content is controlled by the user agent and is not modified by the author.
How is a tooltip not in this exception? Isn't the component meant to implement a customized version of a native title
that isn't ugly?
Why do most custom tooltips don't follow this guideline even if less accessible (subjective)? I think that it's because it's disruptive and surprising. Consider this end-user flow: "I want to click on the action behind the tooltip, why is this tooltip covering it? Why is it still visible? Why would I need to copy the text inside the tooltip?"
At the minimum, I think that it should be configurable. At best, I don't think that we should change it and document this aspect.
Related discussion: reach/reach-ui#439. Maybe we should do that?
all components will be audited by WebAIM prior to our 1.0 release and we'll get clarity on our approach to tooltip at that time.
Related discussion: twbs/bootstrap#28411
Edit: this makes me think about the cursor: pointer thread, once everybody stop following the accessibility recommendations, it's probably no longer relevant: creating more frustration than intuitive UIs.
The tooltip is not implemented by the user agent but author. Edit: The statements in the reach-ui issue are outdated. WCAG 2.1 has been finalized for 2 years now. |
If they want to build harmful UIs then I don't want to help them. If they have good reasons for different behavior the alpha is the perfect time to ask them. |
It's a solid counter-argument to my previous message, we can't really know without trying it out (experimenting).
I was using the perspective: the intent is to reproduce user-agent behavior, it's implemented by the author. At the end of the day intent > implementation. |
I didn't claim I knew. You were the one asking rhetorical questions to which no one has an answer. The only constructive proposal is this PR: It's alpha time and our Tooltip is clearly violating 1.4.3. Let's experiment with a variant that doesn't. That's really not as controversial as you act it out. Especially since you seemed to have responded to this PR without reading the linked resources. They pretty clearly explain why |
Why would that be the intent? The |
Maybe I should have been more factual. WCAG21 support the need for this behavior with two use cases:
The tooltip is meant to display a short message, we always update the position of the tooltip to avoid scrolling. The first use case doesn't seem to apply.
What about the 14 pixels margin + 3 pixels padding that is added + the size of the element the tooltip wraps, isn't that enough to solve the problem? So unless the cursor takes more than 45x45 pixels it should be fine (default cursor is 18x10 pixels on MacOS) (with the default MD theme). Now, the specification doesn't mention the hidden cost of changing the behavior. What about the surprise it creates when you want to interact with an element that is hidden by the tooltip? e.g. on Gmail moving the cursor to reply all: This problem is worse in our case because we have a wider gap (14px instead of 0px) between the anchor element and the tooltip than Gmail. |
I have tried to collect more feedback on https://twitter.com/olivtassinari/status/1299493764768108544. How about? |
No strong opinion. I'm not sure I understand the practical value in applying success criterion 1.4.3 in WCAG 2.1 to a tooltip, but it's "mostly harmless". However the behaviour where the hover indicator disappears when the mouse moves off the item the tooltip is attached to, but the tooltip stays open "feels" like a bug in use: |
In general I don't think it's very valuable to discuss the merits of WCAG criterions. There are definitely choices I would question but discussing these here is a bit "easy" so to speak since the original authors of these texts can't respond. As far as I can tell the immediately actionable decision we can make is whether we support level A, AA (the level mostly cited in laws) or AAA by default. Starting from that we can make a decision how "easy" it should be to violate particular success criterion. Though I think we agree that it should be as easy as possible to reach a certain level. Deciding on a level is useful to document accessibility of the library. I know that most libraries just say "a11y in mind" or "a11y as 1st class citizen" but these statements don't hold any facts. And without them you can't be held accountable which I think is important for building trust with users. Or at least document for each component the default level so that devs can choose a subset that fits their needs. Stating what parts are not accessible in one way or another is usually part of a11y statements From these decisions the Tooltip evolves in one of three ways (SC 1.4.3 is synonymous with level AA,
Point 2. and 3. are different with regard to how difficult we want violating 1.4.3 to be.
As far as I understood it it's about screen magnifier usage. Depending on the size of the tooltip and its distance to the original object you might not be able to magnify the tooltip content because the magnified view is restricted to the immediate surroundings of the pointer. But again, I don't think there's much value in discussion whether you or I find this success criterion practical. |
@eps1lon This is a great summary!
Regarding what should be the default level all the components should provide. Do we have enough data points to make this decision now? How about we set AAA as a target and in the journey of reaching it, we reevaluate? We would start by tackling all the A levels, then AA, and finally AAA, in this order. Along the way, I imagine we will hit roadblocks, like this very AA 1.4.3 criteria on the tooltip. Regarding the different options available. I would vote for 2. Why?
|
AA is mostly interesting because it's what's required by most a11y related laws. I think mid-term this should be our goal for almost all core components. Not meeting AA should be the exception and include a rationale. AAA is not recommended as a general goal for sites anyway:
-- https://www.w3.org/TR/WCAG21/#cc1 I think the same can apply to component libraries. I wouldn't bother with it for now though definitely keep an eye out. We'll do this incidentally anyway since WCAG isn't structured by components anyway.
What would data tell us here? If you mean your benchmarking methodology then I don't share this sentiment. What other component libraries are doing interests me little compared to why they are doing things. And I'm fairly certain most don't put in the effort due to lack of time or motivation. The only data I have is that AA is recommended by WCAG itself and required by law. With regards to Tooltip: I lean towards changing the default and renaming it to |
@mbrookes How did you reproduce this behavior? What is the "hover indicator" in that context? |
@eps1lon I was thinking of trying the changes to understand the tradeoffs, #22382 is one data point. We have tried to reach AA, we see what we have to give up in exchange.
It sounds good. |
Some qualification needed there I think.
Move the mouse off the item the tooltip is attached to (in the direction of the tooltip)
|
Do you find it useful to get a list of countries that list that requirement? I've only seen level AA but never A or AAA. That's the important part here. Not what countries those are. Or is there a list of countries where you would only consider this important?
You mean the box-shadow of the icon? |
Just in case you mean the displayed text: The whole intention of this PR is to keep to tooltip open when the mouse is moved towards it. The PR is specifically about the "hoverable" part in 1.4.13:
Or do you mean we should implement behavior where the additional content is hidden if the mouse rests on the space in between? I think that would go against the intention of 1.4.13, pretty hard to implement and apply only to a few user intentions. |
Noted.
Yes, in this particular case.
I didn't.
I wasn't proposing a fix, just pointing out a perceived issue with having a disembodied tooltip. |
~@mbrookes What browser/OS/device are you using? I can't reproduce this with Chrome 85/Firefox 80 on Ubuntu desktop: ~ So you're saying this is a bug? I wouldn't see this as one. If it's not hovered then we don't display the hover indicator. This was always the case. |
Yes, I wasn't suggesting that it's a regression, rather that the new behavior of tooltip staying open when the mouse moves towards it while the focus indicator of the associated component disappears, "feels" like a bug in use. The tooltip is left without a visible "owner". Consider for example a menu where the parent item retains its focus indicator when the mouse moves to the menu, but not when otherwise leaving the menu: |
I don't see how we're ever able to implement this behavior. Since this isn't a regression can we keep this as an open issue? A possible workaround would be to use |
@eps1lon It sounds like we can move forward, #22382 (comment) addresses the last concern. |
08fb0a9
to
62246d1
Compare
@@ -19,7 +19,7 @@ export interface TooltipProps extends StandardProps<React.HTMLAttributes<HTMLDiv | |||
classes?: { | |||
/** Styles applied to the Popper component. */ | |||
popper?: string; | |||
/** Styles applied to the Popper component if `interactive={true}`. */ | |||
/** Styles applied to the Popper component unless `disableInteractive={true}`. */ |
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 have used the following pattern in the other components:
/** Styles applied to the Popper component unless `disableInteractive={true}`. */ | |
/** Styles applied to the Popper component if `disableInteractive={false}`. */ |
Should we stick with it? cc @mbrookes
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.
The thing is that you'll almost never see someBooleanProp={false}
with our API design philosophy.
It's also incomplete since the styles are also applied without any code. My approach is covering false
and undefined
while your approach only covers 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 personally prefer "unless true" over "if false".
Ok let's get this in and wait for angry reports from tooltip-heavy UIs. |
Hi guys, I noticed this is not updated on the document. |
Breaking changes
[Tooltip] Tooltips are now interactive by default.
The previous default behavior failed success criterion 1.4.3 ("hoverable") in WCAG 2.1.
To reflect the new default value, the prop was renamed to
disableInteractive
.If you want to restore the old behavior (thus not reaching level AA), you can apply the following diff:
Preview: https://deploy-preview-22382--material-ui.netlify.app/components/tooltips/#main-content
With #22376 ("dismissable") and this PR ("hoverable") our Tooltip now no longer violates success criterion 1.4.13 in WCAG 2.1.
I removed the prop entirely. Let's wait for feedback during alpha before adding something like
disableInteractive
. This would allow making inaccessible sites with props which I don't want to allow. Though there may be good reasons to do so.https://www.w3.org/WAI/WCAG21/Understanding/content-on-hover-or-focus.html has more context on why tooltips should be hoverable.