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

[v4] Switch default breakpoints to rem #13469

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

barvian
Copy link
Contributor

@barvian barvian commented Apr 7, 2024

This was seemingly considered/planned for v4 (mentioned by @adamwathan in #8378), but I didn't see it in the codebase. Feel free to delete this PR if plans changed! I used rem instead of em because the functionality seems to be the same, and it's consistent with the spacing and type scales.

@barvian barvian changed the title [v4] Switch breakpoints to rem #8378 [v4] Switch breakpoints to rem Apr 7, 2024
@barvian barvian changed the title [v4] Switch breakpoints to rem [v4] Switch default breakpoints to rem Apr 9, 2024
@barvian
Copy link
Contributor Author

barvian commented Apr 9, 2024

Yikes, not sure how I missed those tests. Fixing now.

@barvian
Copy link
Contributor Author

barvian commented Apr 9, 2024

I'm getting a bunch of indentation-related changes between the test snapshots and the test results, i.e.

- ::file-selector-button {
-   appearance: button;
- }
+   ::file-selector-button {
+     appearance: button;
+   }

Any ideas how to address this? Sorry if it's obvious, I haven't used vitest before.

@adamwathan
Copy link
Member

No worries fixed them! I usually just run pnpm run tdd and press u in the terminal to update the snapshots automatically, then check the diff to make sure the updates all seem correct to me 👍

@adamwathan adamwathan merged commit 7347cdd into tailwindlabs:next Apr 10, 2024
1 check passed
@florianbouvot
Copy link
Contributor

@barvian @adamwathan No issue with rem unit?
I remember this about em unit for Media Queries: https://adamwathan.me/dont-use-em-for-media-queries/

@adamwathan
Copy link
Member

@florianbouvot In my testing everything seems to work now in modern browsers, but the fastest way to find out if there's a problem is to release it 😄

@barvian
Copy link
Contributor Author

barvian commented Apr 25, 2024

@barvian @adamwathan No issue with rem unit? I remember this about em unit for Media Queries: https://adamwathan.me/dont-use-em-for-media-queries/

I've used rem breakpoints in production sites with extensive browser testing and haven't seen any issues 🙂

@yeliex
Copy link

yeliex commented May 21, 2024

actually, breakpoints are relative to window viewport size, and not affected by font size or other contents on your page.

in that situation, it is better to keep behavior as traditional, just keep it in px. it is not hard to extend to use rem as someone's requirements, but definitely not for most cases.

It is of course works well to use rem when keeps real size with 16px as the root font-size default, but strange to definition of breakpoint and takes more understand cost.

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.

4 participants