fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

[Bug]: Unable to attach Tooltip to an icon

Open jurokapsiar opened this issue 3 years ago • 2 comments

Library

React Components / v9 (@fluentui/react-components)

System Info

Fluent UI v9

Are you reporting Accessibility issue?

No response

Reproduction

https://codesandbox.io/s/loader-migration-fluentui-forked-5c5wd7?file=/example.tsx

Bug Description

Actual Behavior

When a tooltip is attached to an icon, hovering over the icon does not show the tooltip

Expected Behavior

Tooltip is shown when the user hovers on an icon.

Attaching tooltips on non-focusable elements is not accessible. However in cases where feature teams find an alternative and approved way of presenting the information to screen reader and keyboard users, there needs to be a possibility to have tooltip on an icon.

Logs

No response

Requested priority

High

Products/sites affected

Teams

Are you willing to submit a PR to fix?

no

Validations

  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] The provided reproduction is a minimal reproducible example of the bug.

jurokapsiar avatar Aug 26 '22 16:08 jurokapsiar

When I run on localhost using yarn start, the tooltip isn't working. Everytime I hover over it, it appends a new div to page's body. But when I run the assets generated by yarn build it works.

image

eduardogoncalves avatar Aug 28 '22 19:08 eduardogoncalves

It looks like this is caused by the fact that icons from @fluentui/react-icons don't currently forward refs to their underlying DOM element, which is a requirement for v9 Tooltip. (Or any v9 popup element; attempting to attach a Popover to an icon also doesn't work, though nobody would actually do that). There's a console error in the repro codesandbox when trying to show the tooltip:

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

I'm going to assign this to @tomi-msft to make the fix in the @fluentui/react-icons package.

behowell avatar Sep 19 '22 23:09 behowell

https://github.com/microsoft/fluentui-system-icons/pull/505

tomi-msft avatar Nov 21 '22 21:11 tomi-msft

The PR above fixes this issue, but need to confirm if we consider this a breaking change and need to major rev the package.

tomi-msft avatar Dec 05 '22 21:12 tomi-msft

This will need a major verision bump to react-icons. We're going to wait and do it at the same time as https://github.com/microsoft/fluentui/issues/25989

behowell avatar Feb 02 '23 22:02 behowell