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

fix: blurry text on browser zoom #54

Closed
wants to merge 1 commit into from
Closed

Conversation

ayoung19
Copy link

@ayoung19 ayoung19 commented Apr 24, 2023

If you zoom out in the browser on some devices, floating items are blurred.

description of the issue: floating-ui/floating-ui#779

mention of blurriness in floating-ui docs: https://floating-ui.com/docs/misc#subpixel-and-accelerated-positioning

x and y can contain fractional numbers (decimal), so there will be blurring unless we place it evenly on the device’s pixel grid. The rounding method above ensures the floating element is positioned optimally for the screen.

fixing with basic floating-ui example: https://floating-ui.com/docs/react#positioning

@ycs77
Copy link
Owner

ycs77 commented Apr 25, 2023

@ayoung19 Thanks for the PR, but to achieve the desired effect, you can use transform={false} instead, the transform prop allows users to choose their preferred positioning method (transform or top/left) (see: https://headlessui-float.vercel.app/react/other-options.html#position-mode), so I will close this PR for now 😅.

@ycs77 ycs77 closed this Apr 25, 2023
@ayoung19
Copy link
Author

ah got it, totally missed that option. i think the default should be false because if we want the normal correct behavior we have to put transform={false} everywhere and it's not really clear that the reason for that is to make it not blurry

@ycs77
Copy link
Owner

ycs77 commented Apr 26, 2023

OK, I'll do some research to see if this adjustment is a breaking change.

ycs77 added a commit that referenced this pull request Sep 27, 2023
* Fix blurry text on browser zoom (#54)
* Fixed the issue that the transition of CSS `transform` would not work properly when `floating-as` is set to `template / Fragment`, because the `transform` prop defaults to `true`
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.

None yet

2 participants