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

[BUG] Tooltips no longer disappear, when opacity: 1 #1112

Closed
ansgarsteinkamp opened this issue Nov 2, 2023 · 8 comments · Fixed by #1113
Closed

[BUG] Tooltips no longer disappear, when opacity: 1 #1112

ansgarsteinkamp opened this issue Nov 2, 2023 · 8 comments · Fixed by #1113
Labels

Comments

@ansgarsteinkamp
Copy link

Version: 5.22.0

Description: In order to be able to style the tooltips with Tailwind CSS, I use a class "classNamesTooltip", in which I set "opacity: 1". Since version 5.22.0, this results in the tooltips no longer disappearing.

A

B

C

@gabrieljablonski
Copy link
Member

gabrieljablonski commented Nov 2, 2023

Setting the opacity through CSS is not supported, even before 5.22.0 it wasn't supposed to work. Use the opacity prop on the tooltip instead.

<Tooltip opacity={1} />

@EmanuelU
Copy link

EmanuelU commented Nov 2, 2023

I had the same issue, thanks! Solved by changing to

<Tooltip opacity={1} />

@anch09
Copy link

anch09 commented Nov 3, 2023

I got the same bug, with the latest version at the date today which is 5.22.0 the tooltips are not dissappearing when mouserleave event is triggered.

@gabrieljablonski
Copy link
Member

@anch09, as mentioned above, this is not a bug. Have you tried using the opacity prop?

#1113 will add this more clearly to the documentation.

@anch09
Copy link

anch09 commented Nov 3, 2023

@gabrieljablonski so it's intended to work as it from the version 5.22.0? because for me it's way better how it used to be before

@gabrieljablonski
Copy link
Member

@anch09 yes, the previous behavior was not intended. If setting the opacity through CSS is better for you, you can also try overriding --rt-opacity like this

:root {
  --rt-opacity: 1;
}

@targumon
Copy link

targumon commented Nov 9, 2023

Setting the opacity through CSS is not supported, even before 5.22.0 it wasn't supposed to work.

Wasn't aware of that. Somehow it DID work for me.
Anyway, I switched to use the opacity={1} prop.

👍 Works fine in a real browser - thanks!
👎 But... throws in tests. I'm using react-testing-library & jest and get CSS.supports is not a function errors.

For now I just mocked the function.
In file setupTestsAfterEnv.js I added:

global.CSS.supports ||= () => true

(can probably also do it in setupTests.js - I don't remember the difference. They're both referred from jest.config.js in properties setupFilesAfterEnv & setupFiles respectively)

However, I think this line should be modified:

if (opacity && !CSS.supports('opacity', `${opacity}`)) {

to include a check:

if (opacity && 'supports' in CSS && !CSS.supports('opacity', `${opacity}`)) {

(similar to what these guys did here: https://github.com/wojtekmaj/react-fit/pull/3/files )

LMK if you want me to open a PR and thanks again! 🙏

@gabrieljablonski
Copy link
Member

@targumon thanks for heads up. #1117 should fix the problem with CSS.supports().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants