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

handle viewport values for breakpoint preview #4748

Merged
merged 19 commits into from
Oct 17, 2024

Conversation

ETLaurent
Copy link
Contributor

@ETLaurent ETLaurent commented Oct 7, 2024

Summary

Use a custom postcss plugin to duplicate declarations containing vh and vw (and only those) and change the units to container query compatibles ones (cqh, cqw) into a rule prefixed by :where(body[data-device-preview-mode]) to take them into account only on breakpoint preview mode.

Example: given I have the following CSS

main {
  height: 100vh;
}

I want to end up with the following CSS:

main {
  height: 100vh;
}

:where(body[data-device-preview-mode]) main {
  height: 100cqh;
}

What are the specific steps to test this change?

For example:

  1. Run the website and log in as an admin
  2. Open a piece manager modal and select several pieces
  3. Click the "Archive" button on the top left of the manager and confirm that it should proceed
  4. Check that all pieces have been archived properly

What kind of change does this PR introduce?

(Check at least one)

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Build-related changes
  • Other

Make sure the PR fulfills these requirements:

  • It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • The changelog is updated
  • Related documentation has been updated
  • Related tests have been updated

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

Copy link

linear bot commented Oct 7, 2024

@@ -17,6 +17,7 @@ body[data-breakpoint-preview-mode] {
}

[data-apos-refreshable] {
position: relative;
Copy link
Contributor Author

@ETLaurent ETLaurent Oct 7, 2024

Choose a reason for hiding this comment

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

absolute stuff are now correctly scoped

@ETLaurent ETLaurent changed the title wip handle viewport values for device preview Oct 7, 2024
@ETLaurent ETLaurent requested a review from haroun October 8, 2024 10:22
@ETLaurent ETLaurent marked this pull request as ready for review October 8, 2024 10:23
boutell
boutell previously approved these changes Oct 8, 2024
@ETLaurent ETLaurent changed the title handle viewport values for device preview handle viewport values for breakpoint preview Oct 8, 2024
Copy link
Contributor

@haroun haroun left a comment

Choose a reason for hiding this comment

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

@ETLaurent Did you check also if vh units in vue files worked?

test/postcss.js Outdated Show resolved Hide resolved
@ETLaurent ETLaurent requested a review from haroun October 15, 2024 14:11
@ETLaurent
Copy link
Contributor Author

ETLaurent commented Oct 15, 2024

@ETLaurent Did you check also if vh units in vue files worked?

@haroun yes:

code / generated stylesheet actual rendering
image image

haroun
haroun previously approved these changes Oct 17, 2024
@ETLaurent ETLaurent merged commit aa01f5e into main Oct 17, 2024
8 checks passed
@ETLaurent ETLaurent deleted the pro-6637-mobile-preview-does-not-support-vhvw-units branch October 17, 2024 12:24
haroun added a commit to haroun/apostrophe that referenced this pull request Oct 18, 2024
* upstream/main:
  handle viewport values for breakpoint preview (apostrophecms#4748)
  Pro 6678 mobile preview dropdown (apostrophecms#4768)
  Fix menu focus (apostrophecms#4767)
  Update changelog for translations (apostrophecms#4766)
  [generate] Translate to German (apostrophecms#4759)
  [generate] Translate to Spanish (apostrophecms#4760)
  [generate] Translate to French (apostrophecms#4761)
  [generate] Translate to Italian (apostrophecms#4762)
  [generate] Translate to Portuguese (Brazil) (apostrophecms#4763)
  [generate] Translate to Slovak (apostrophecms#4764)
haroun added a commit that referenced this pull request Oct 22, 2024
* feature-vite:
  sass import warning (#4776)
  PRO-6657: Following values for dynamic choices (#4770)
  Tests
  HMR triggers, refactor to async due to upcoming EMS changes
  warnDev now prefixes in the expected way (#4746)
  Pro 6666 page move setting page as modified (#4771)
  handle viewport values for breakpoint preview (#4748)
  Pro 6678 mobile preview dropdown (#4768)
  Fix menu focus (#4767)
  Update changelog for translations (#4766)
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