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

[OverflowMenuItem] itemText cannot put Tooltip component #7088

Closed
2 tasks done
dawang021 opened this issue Oct 20, 2020 · 12 comments
Closed
2 tasks done

[OverflowMenuItem] itemText cannot put Tooltip component #7088

dawang021 opened this issue Oct 20, 2020 · 12 comments

Comments

@dawang021
Copy link

dawang021 commented Oct 20, 2020

What package(s) are you using?

"carbon-components": "10.22.0",
"carbon-components-react": "7.22.0",
  • carbon-components
  • carbon-components-react

Detailed description

Describe in detail the issue you're having.

Is this issue related to a specific component?

What did you expect to happen? What happened instead? What would you like to
see changed?

What browser are you working in?

What version of the Carbon Design System are you using?

What offering/product do you work on? Any pressing ship or release dates we
should be aware of?

Steps to reproduce the issue

  1. Use OverflowMenu, OverflowMenuItem component in DataTable TableCell.
  2. The whole OverflowMenu cannot open anymore.

Sandbox reproduce: https://codesandbox.io/s/overflow-menu-with-tooltip-8iykr?file=/src/index.js

Additional information

  • Screenshots or code
  • Notes
@tw15egan
Copy link
Collaborator

@dawang021 it is really helpful if you fill out the issue template so we can help you get sorted out properly. Do you have a link to a reproducible example on CodeSandbox? I am unable to reproduce the problem on our end: https://react.carbondesignsystem.com/?path=/story/datatable--with-overflow-menu

@dawang021
Copy link
Author

@tw15egan please take a look at this demo in sandbox: https://codesandbox.io/s/overflow-menu-with-tooltip-8iykr?file=/src/index.js

@tw15egan
Copy link
Collaborator

I don't believe Tooltip is supported inside of an overflow menu. Overflow menu actions should be short, concise actions that do not need additional information. You could place the tooltip outside of the menu if more information is needed.

Please see this link for more info: https://www.carbondesignsystem.com/components/overflow-menu/usage#formatting

@dawang021
Copy link
Author

@tw15egan But it works in lower version https://codesandbox.io/s/overflow-menu-with-tooltip-working-well-hsdwo?file=/src/index.js.
image

The reason why I want to add Tooltip in OverflowMenuItem is OverflowMenuItem can be disabled, so I want to let users know why this OverflowMenuItem is disabled.

@tw15egan
Copy link
Collaborator

OverflowMenu items that are disabled are not in the tab order, so a keyboard user would not be able to navigate to this item and it would cause an a11y violation. That is why this pattern is not recommended.

@dawang021
Copy link
Author

dawang021 commented Oct 23, 2020

What is your recommendation/implementation using OverflowMenuItem to notify users why this item is disabled?

I don't think there isn't a need to not let users know the reason for disabled actions.

@tw15egan
Copy link
Collaborator

What action are they trying to take that might be disabled? Could any type of UX pattern be used outside of the overflow menu to let the user know why they cannot do something? Does that item even need to be shown if it is not a viable action? Posting user flows here would help our team give guidance around this situation

@dawang021
Copy link
Author

dawang021 commented Nov 11, 2020

In IBM cloud VPC load balancer backend pools, we give the reason why this pool is not able to delete.
image

@tw15egan
Copy link
Collaborator

tw15egan commented Nov 11, 2020

Can you try setting focusTrap={false} on the Tooltip? Or perhaps try using TooltipDefinition?

@emyarod
Copy link
Member

emyarod commented Nov 11, 2020

I don't think TooltipDefinition would be valid DOM since it would be nesting a button within a button (maybe it would work if you add an href to the OverflowMenuItem since that changes the element to an anchor I believe). seems iffy though

<OverflowMenuItem
  href="#" // renders <a> rather than <button>
  itemText={
    <TooltipDefinition tooltipText="some tooltip text">
      Option 2
    </TooltipDefinition>
  }
/>

your best bet until the Carbon interactive tooltip gets overhauled is probably using requireTitle and title

<OverflowMenuItem
  requireTitle
  itemText="Option 2"
  title="some tooltip text"
/>

edit: looks like custom title is not supported since it defaults to itemText when requireTitle is true (resolved in #7277)

@emyarod
Copy link
Member

emyarod commented Nov 12, 2020

related #6605

@sstrubberg
Copy link
Member

hey @dawang021, thanks for creating the issue. What you're trying to accomplish here with Tooltip and OverflowMenu isn't a supported pattern. This is most likely going to create an accessibility violation.

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

No branches or pull requests

6 participants