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

[@mantine/core] Tooltip floatingStrategy=fixed updates position to fixed #6502

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[@mantine/core] Tooltip floatingStrategy=fixed updates position
Laura Chan committed Jul 9, 2024
commit 07afd468872ca0c46ef1a30dbf96ed61f5ea2ee4
Original file line number Diff line number Diff line change
@@ -21,6 +21,10 @@
&:where([data-multiline]) {
white-space: normal;
}

&:where([data-fixed]) {
position: fixed;
}
}

.arrow {
17 changes: 17 additions & 0 deletions packages/@mantine/core/src/components/Tooltip/Tooltip.story.tsx
Original file line number Diff line number Diff line change
@@ -223,3 +223,20 @@ export function DefaultOpened() {
</div>
);
}

export function Fixed() {
return (
<div style={{ padding: 40 }}>
<Tooltip
position="right"
label="Tooltip has fixed position"
withArrow
transitionProps={{ duration: 0 }}
opened
floatingStrategy="fixed"
>
<button type="button">target</button>
</Tooltip>
</div>
);
}
1 change: 1 addition & 0 deletions packages/@mantine/core/src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -217,6 +217,7 @@ export const Tooltip = factory<TooltipFactory>((_props, ref) => {
{(transitionStyles) => (
<Box
{...others}
data-fixed={floatingStrategy === 'fixed' || undefined}
variant={variant}
mod={[{ multiline }, mod]}
{...tooltip.getFloatingProps({