Cannot put Tooltip on OverflowMenu custom trigger icon
See original GitHub issueWhat package(s) are you using?
-
carbon-components
- [x ]
carbon-components-react
Detailed description
Describe in detail the issue you’re having.
I cannot put a Tooltip on an OverflowMenu icon.
Is this issue related to a specific component?
OverflowMenu and TooltipIcon
What did you expect to happen? What happened instead? What would you like to see changed?
I expected this to happen without errors:
Instead, I got this error in the console:
Warning: validateDOMNesting(...): <button> cannot appear as a descendant of <button>.
I would love to have the ability to put a Tooltip on an OverflowMenu button.
What browser are you working in?
Chrome
My Code
<OverflowMenu
style={{height: '3rem', maxHeight: '3rem', width: '3rem', background: '#f4f4f4'}}
renderIcon={() => <TooltipIcon direction={"top"} align={"center"} style={{borderBottom: '0'}} tooltipText={"Status"}> <EventSchedule20 /> </TooltipIcon>}
>
{menuItems}
</OverflowMenu>
Thank you very much for your time! Hopefully there’s a workaround or a solution I’m missing.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Extjs tooltip on overflow button
You can add a tooltip to the overflow button during the afterrender event of the toolbar. The target element would be this.layout.overflowHandler.
Read more >Tooltips - Bootstrap
The tooltip plugin generates content and markup on demand, and by default places tooltips after their trigger element. Trigger the tooltip via JavaScript:...
Read more >How to Create an HTML Tooltip [+ Code Templates]
To make a simple tooltip, we'll first create the HTML element that triggers the tooltip when hovered over. We'll create this element as...
Read more >Tooltip – Carbon Design System
Icon button tooltip anatomy · Icon button: Button that triggers a tooltip on hover or focus · Caret tip: Closely associates container to...
Read more >Bootstrap tooltips - CoreUI
Elements with the disabled attribute aren't interactive, meaning users cannot focus, hover, or click them to trigger a tooltip (or popover). As a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you very much for your feedback @emyarod ! I managed to get it done! Here it is 😃 :
To achieve this I added the following props:
And this CSS rule applied to these selectors:
(previously the first argument to translate was -50%, that’s why it was going over the endge of the page)
So the reason why it was rendering
"Menu"
instead of"your tooltip label"
was because I was using the proparia-label
instead ofariaLabel
in camelcase. As soon as I renamed the prop fromaria-label
toariaLabel
the correct string showed up.I’ll close the issue, hopefully anyone that has the same problem can find this helpful.
you can add the
.bx--tooltip--align-start
(oralign-end
) class to change the alignment. these classes are just taken from the definition and icon tooltipI’m not entirely sure where the text comes from without seeing your source code but it most likely is the text within
.bx--assistive-text
if you are following the tooltip/icon-only button markup