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

[EuiToolTip] Tooltip should adjust its position when the anchor element moves #8266

Open
acstll opened this issue Jan 10, 2025 · 3 comments
Open
Labels

Comments

@acstll
Copy link
Contributor

acstll commented Jan 10, 2025

Describe the bug
When a tooltip is anchored to an element (e.g. button) that is fixed-positioned and that changes positions when clicked, the tooltip won't follow. This creates an unwanted state where the tooltip is visible but not correctly positioned.

The repositionOnScroll prop does not help in this case, because there is no scrolling involved. The position that changes is the anchor's (button), not the scroll.

Impact and severity
I don't think it's common pattern to have a button fixed-positioned, that moves as it gets clicked, but this issue was reported so it should have some end-user impact.

Environment and versions

  • EUI version: 99.0.0
  • React version: 18
  • Kibana version (if applicable): ~
  • Browser: ~
  • Operating System: ~

To Reproduce
You need a button that:

  • uses EuiToolTip
  • has position: fixed (or absolute)
  • changes position when it gets clicked

Expected behavior
The tooltip element should adjust its position to follow its anchor.

Minimum reproducible sandbox
https://codesandbox.io/p/sandbox/gallant-shockley-629j49

Screenshots
Image

@acstll acstll added the bug label Jan 10, 2025
@JasonStoltz
Copy link
Member

We may be able to solve this by adding a dismiss callback, which would let consumers programatically dismiss tooltips. That would solve this particular use case indirectly.

@JasonStoltz
Copy link
Member

@acstll You had some thoughts about anchoring, could you add them here as well?

@acstll
Copy link
Contributor Author

acstll commented Jan 14, 2025

The new CSS anchor() API

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

No branches or pull requests

2 participants