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

[Tooltip] Support tooltips for disabled buttons #22937

Closed
wants to merge 2 commits into from

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Oct 8, 2020

https://deploy-preview-22937--material-ui.netlify.app/components/tooltips/#disabled-elements

Use pointer events instead of mouse events. That way we don't have to deal with quirky mouseenter on disabled buttons (which should work by spec but is not implemented for historic reasons: w3c/pointerevents#177). We can leverage pointer events even though we support Safari 12.1 on iOS because in that environment the tooltip is triggered by the touchstart event.

Needs:

  1. spec crawling
    1. Seems to be intended reading Pointer events & disabled form elements w3c/pointerevents#177
      From that issue it sounds like mouseenter not firing is due to a historical misinterpretation of the spec.
      Since PointerEvents are new browsers had a chance to remedy this without breaking compat.
  2. browser testing
    1. Linux
      1. Chrome 85
      2. Firefox
    2. MacOS
      1. Chrome 85
      2. Safari 13
    3. Windows
      1. Chrome 85
      2. Edge 85
      3. Firefox 75
    4. iOS
      1. Safari 12
  3. discuss how we reconcile the "anchor as a button" use case and whether we support disabled anchors.
    Right now we implement most of the expected behavior for disabled elements by adding pointer-events: none;.
    We do this for the anchor and div[role="button"] use case as well as to not apply hover styles.
    I would propose that we rather implement these behaviors properly so that we have better support for the default <button type="button" /> use case e.g. allow cursor: not-allowed
  4. fix tests

Motivation

Wrapper elements for disabled buttons with tooltips are pretty hard since we only want event handlers on the wrapper. Everything else should go on the button e.g. aria-label.

@eps1lon eps1lon added accessibility a11y component: tooltip This is the name of the generic UI component, not the React module! labels Oct 8, 2020
@mui-pr-bot
Copy link

mui-pr-bot commented Oct 8, 2020

Details of bundle changes

Generated by 🚫 dangerJS against 481a60c

@eps1lon eps1lon force-pushed the feat/Tooltip/disabled-button branch from 157d0e3 to 481a60c Compare October 15, 2020 14:54
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 17, 2020
@eps1lon
Copy link
Member Author

eps1lon commented Dec 15, 2020

Blocked by #23101

@eps1lon eps1lon deleted the feat/Tooltip/disabled-button branch September 14, 2021 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y component: tooltip This is the name of the generic UI component, not the React module! PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants