mi6 / ic-ui-kit

Intelligence Community UI Kit (based on StencilJS)
MIT License
24 stars 25 forks source link

[ic-card] Tooltips not attaching to child components correctly #2360

Closed GCHQ-Developer-299 closed 1 week ago

GCHQ-Developer-299 commented 2 weeks ago

Summary of the bug

When an IcTooltip is wrapped around an IcChip inside an IcCard, the tooltip renders beneath the Card instead of the Chip. This might be the case for other components too.

🪜 How to reproduce

See the code snippet below

📸 Screenshots or code

React Stackblitz - can be replicated inside Storybook too.

<IcCard heading="heading" fullWidth="true">
      <IcTooltip label="test" target="test-id" slot="message">
        <IcChip id="testid" label="chip" />
        <p>Hello World</p>
      </IcTooltip>
    </IcCard>
Screenshot 2024-08-29 at 15 45 13 Screenshot 2024-08-29 at 15 45 27

🧐 Expected behaviour

The Tooltip should be below the Chip.

GCHQ-Developer-299 commented 1 week ago

Suggestion from another developer:

It looks like the tooltip might have a display block which stretches it's area all the way to the end of the container (even if it's white space). The tooltip is centered to the area. We'll need to update the tooltip so that it has a display:inline or something along those lines.

GCHQ-Developer-299 commented 1 week ago

In code example p tag was inside tooltip, block level element interfered with tooltip placement