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

Enable by default, other tweaks #4741

Merged
merged 2 commits into from
Oct 3, 2024
Merged

Enable by default, other tweaks #4741

merged 2 commits into from
Oct 3, 2024

Conversation

boutell
Copy link
Member

@boutell boutell commented Oct 2, 2024

  • enable by default
  • adjust the breakpoints to give them a basis in popular device sizes
  • change the option name and translation key names (we can do the rest later) to match the way we talk about the feature elsewhere before it is too late to harmonize them

…ular device sizes, change the option name and translation names (we can do the rest later) to match the way we talk about the feature elsewhere
@boutell boutell requested a review from haroun October 2, 2024 19:34
@@ -89,6 +89,7 @@ module.exports = {

async init(self) {

self.options.devicePreviewMode = self.options.breakpointPreviewMode || self.options.devicePreviewMode;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is temporary until the rest of the logic can be changed over, I didn't want to cowboy that and risk bugs, the idea is to document breakpointPreviewMode and change the rest of the code when we have time

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm doing the changes, releasing with the two names will only make our life harder.

enable: false,
breakpointPreviewMode: {
// Enable breakpoint preview mode
enable: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please tell me if we're missing something, e.g. we think this feature is highly likely to break somebody's build completely if we default it to true. Otherwise we really want people to have this experience out of the box

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do some css transformations on css declarations inside media queries.
If you have

@media (max-width: 700px) {
  main {
    width: 100%;
  }
}

you will end up with

@media (max-width: 700px) {
  :where(:not(body[data-breakpoint-preview-mode])) main {
    width: 100%;
  }
}
@container (max-width: 700px) {
  main {
    width: 100%;
  }
}

:where is widely supported https://developer.mozilla.org/en-US/docs/Web/CSS/:where

I should be safe to use.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was the main driver for setting enabled: false by default.

@boutell boutell requested a review from BoDonkey October 3, 2024 12:39
Copy link
Contributor

@BoDonkey BoDonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@haroun haroun merged commit a5efac5 into main Oct 3, 2024
8 checks passed
@haroun haroun deleted the breakpoint-adjustments branch October 3, 2024 13:16
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.

3 participants