Skip to content

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

Closed

Description

@acstll

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

Activity

  1. JasonStoltz commented on Jan 14, 2025

    @JasonStoltz
    Contributor

    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.

  2. JasonStoltz commented on Jan 14, 2025

    @JasonStoltz
    Contributor

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

  3. acstll commented on Jan 14, 2025

    @acstll
    ContributorAuthor
  4. self-assigned this
    on Feb 18, 2025
  5. vera commented on Feb 18, 2025

    @vera

    We've noticed this bug as well. However, we are not using a button with position: fixed or absolute.

    In our case, the button moves because other DOM elements are inserted before it due to the button click.

    I've created a sandbox showing that here: https://codesandbox.io/p/sandbox/peaceful-voice-229s4j

    Screencast.from.18.02.2025.15.52.59.webm

    The code sandbox also includes a hack/fix to close the tooltip after the button click, so the bug doesn't become visible.

    To close the tooltip, unfocus the button by calling blur in the onClick function:

    onClick={(e) => {
                e.currentTarget.blur();
                // ...
            }}
    

    (cc @julian-schneider who found the fix)

  6. github-actions commented on Nov 1, 2025

    @github-actions

    👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.

  7. added
    stale-issue
    on Nov 1, 2025
  8. acstll commented on Nov 5, 2025

    @acstll
    ContributorAuthor

    related: #7102

  9. removed
    stale-issue
    on Nov 6, 2025
  10. weronikaolejniczak commented on Mar 20, 2026

    @weronikaolejniczak
    Contributor

    @alexmarhaba the anchor functionality that Arturo is mentioning ☝🏻 would greatly improve the tooltips. Could be worth, as part of the component sweep, to spike out if we can already use this API, which would potentially resolve this issue.

  11. weronikaolejniczak commented on Apr 28, 2026

    @weronikaolejniczak
    Contributor

    @kfirpeled @vera Both of your cases seem to happen because the tooltip is persisted after a mouse click. After [EuiToolTip] Tooltips on buttons persist after clicking #9520 is merged that should no longer be the case.

  12. weronikaolejniczak commented on May 6, 2026

    @weronikaolejniczak
    Contributor

    The issue has been addressed and the fix released on v115.0.0.

    @kfirpeled the change will be added to Kibana by EOW.

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

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions