Skip to content

[EuiTooltip] Scrolls off the anchor upon page or parent scroll #5604

@awahab07

Description

@awahab07

Summary

EuiTooltip attached to a button scrolls off the button when parent is scrolled. This might be only happening when the anchor element is itself on a popover. As is the below snapshot, the tooltip is attached to a button where the button is inside an overlay container (bottom sheet).

Screenshot 2022-02-04 at 15 39 56

Video for reference:

Screen.Recording.2022-02-04.at.16.17.59.mov

Consumer code for reference:

<EuiFlexItem grow={false} style={{ marginRight: 20 }}>
  <EuiToolTip content={TEST_NOW_DESCRIPTION}>
    <EuiButton
      fill
      size="s"
      color="success"
      iconType="play"
      onClick={() => onTestNow()}
      disabled={!isValid}
      data-test-subj={'monitorTestNowRunBtn'}
    >
      {testRun ? RE_RUN_TEST_LABEL : RUN_TEST_LABEL}
    </EuiButton>
  </EuiToolTip>
</EuiFlexItem>

Proposals 1:

Implement a prop repositionOnScroll on EuiTooltip which should reposition the tooltip when scrolled. EuiPopover already implements it, see. Also see RepositionScrollStrategy in Angular CDK Overlay.

Proposal 2:

Implement a prop hideOnScroll on EuiTooltip (and maybe also on EuiPopover) that when set to true, hides the tooltip when any scroll event happens in the scope of window. See CloseScrollStrategy in Angular CDK Overlay.

Proposal 3:

Implement both 1 and 2 above.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions