Skip to content

[Popper] Consistently calculate logical alignments #1890

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

Merged
merged 1 commit into from
Jan 16, 2023

Conversation

andy-hook
Copy link
Contributor

@andy-hook andy-hook commented Jan 16, 2023

Floating UI automatically accounts for logical position for alignment:

The -start and -end alignments are logical
and will adapt to the writing direction (e.g. RTL) as expected.

https://floating-ui.com/docs/computeposition#placement

However, this is applied inconsistently in our code as the referenced floating node does not received the dir attribute.

Floating UI needs this attribute to invert correctly.

This change fixes an inconsistency with our logical alignment whereby using dir="rtl" on our primitives is inconsistent when using Portal with defaults. In the portalled case unless rtl is applied to the body (or higher) this logical inversion will not happen.

Old behaviour:
CleanShot 2023-01-16 at 10 43 33

New behaviour:
CleanShot 2023-01-16 at 10 43 47@2x

@benoitgrelard benoitgrelard merged commit 9b0b264 into main Jan 16, 2023
@benoitgrelard benoitgrelard deleted the popper-inherit-dir branch January 16, 2023 11:03
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