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

Use absolute as the default Floating UI strategy #3097

Merged
merged 2 commits into from
Apr 15, 2024

Conversation

RobinMalfait
Copy link
Member

This is done for 2 reasons:

  1. The default strategy in Floating UI was already absolute
  2. It can improve performance drastically when using transitions

The main reason we used fixed was to ensure that it wasn't accidentally positioned to another relative element. However, all components that use this FloatingProvider will also use a portal which puts elements in the <body> already so this should be safe.

If it is not safe for your application, then you can still use the fixed strategy.

This is done for 2 reasons:

1. The default strategy in Floating UI was already `absolute`
2. It can improve performance drastically when using transitions

The main reason we used `fixed` was to ensure that it wasn't
accidentally positioned to another `relative` element. However, all
components that use this `FloatingProvider` will also use a portal which
puts elements in the `<body>` already so this should be safe.

If it is not safe for your application, then you can still use the
`fixed` strategy.
Copy link

vercel bot commented Apr 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2024 9:33am
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2024 9:33am

@RobinMalfait RobinMalfait merged commit 888ea12 into main Apr 15, 2024
8 checks passed
@RobinMalfait RobinMalfait deleted the feat/update-default-anchor-strategy branch April 15, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants