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 the Page section's width. #2364

Merged
merged 5 commits into from
Mar 10, 2023
Merged

Fix the Page section's width. #2364

merged 5 commits into from
Mar 10, 2023

Conversation

eugenekasimov
Copy link
Contributor

@eugenekasimov eugenekasimov commented Mar 6, 2023

PR Summary:

Fixes an issue when the page sections looses its width reference.

Why are these changes introduced?

Fixes #2359.

What approach did you take?

I lowered specificity for .page-width:not(.drawer-menu) class to its original one (0-1-0) by changing it to .page-width:where(:not(.drawer-menu))

Visual impact on existing themes

The page section should be looking narrow now as it used to be.

Testing steps/scenarios

  • Step 1

Demo links

Checklist

Copy link
Contributor

@melissaperreault melissaperreault left a comment

Choose a reason for hiding this comment

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

Thank you Eugene!

The width is good but now I am not sure why we are not able to inherit the padding setting anymore, when I add multiple page section, you can notice that the padding setting is not rendering. (Video reference)

assets/base.css Outdated Show resolved Hide resolved
Copy link
Contributor

@melissaperreault melissaperreault left a comment

Choose a reason for hiding this comment

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

Thank you Eugene! Works well now! 🙌 🚢

ludoboludo
ludoboludo previously approved these changes Mar 8, 2023
@LucasLacerdaUX LucasLacerdaUX self-requested a review March 9, 2023 19:03
assets/base.css Outdated
@@ -248,7 +248,7 @@ html.no-js .no-js-hidden {
padding: 0 1.5rem;
}

.page-width:not(.drawer-menu) {
.page-width:where(:not(.drawer-menu)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I may be missing some context from the drawer menu PR, but I'm not sure if I understand the inclusion of :not(.drawer-menu) in this context. The page-width is a very generic class that is meant to be used across all elements on the page, not limited to the header, so increasing its specificity by adding a :not() to target a section-specific element sounds a bit off.

If our goal was to have drawer-menu take up to 100% of the max-width, can we include a class like this:

/* or maybe just .drawer-menu */
.page-width.drawer-menu {
  max-width: 100%;
}

instead, and keep .page-width as it was before? To me, that would make it a bit more clear as to why this element shouldn't have a max-width

As for the use of where(), this matches the example of it in the specs so I'm totally aligned with the solution you proposed :DD 🎉 I'm just not sure if its need could be avoided in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

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

cc @ludoboludo do you have any thoughts on that?

Eugene tried the solution I suggested (override on the specific drawer-menu, rather than rewriteing the selector for the generic page-width) and it seems to produce the same results.

I like both solutions - it's just that the one using where() feels like the problem could be avoided in the first place if we didn't rewrite the generic selector.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like your take on it 👍 Easier and simpler to read

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@melissaperreault melissaperreault left a comment

Choose a reason for hiding this comment

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

🚢

@eugenekasimov eugenekasimov merged commit f48b16e into main Mar 10, 2023
@eugenekasimov eugenekasimov deleted the fix-page-section-width branch March 10, 2023 17:49
pangloss added a commit to pangloss/dawn that referenced this pull request Mar 11, 2023
* shopify/main:
  Improve image sizes in the multicolumn section (Shopify#2349)
  Fix the Page section's width.  (Shopify#2364)
  Update 12 translation files (Shopify#2366)
  Removing "my" from cart popup notification (Shopify#2353)
  [Cart.js] Fix fetch url so it's not hard coded (Shopify#2357) (Shopify#2365)
  Update 1 translation file (Shopify#2352)
  Default Follow on Shop to on
  [Header] Add localization selectors (Shopify#2258)
  Remove async CSS pattern where it may introduce layout shifts (Shopify#2270)
  Change rich text section heading to be of type inline_richtext, also moved rte styling into base.css (Shopify#2326)
  Add drawer menu desktop (Shopify#2195)
  Make header image preload and proper width (Shopify#2307)
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* Increase specificity for page-width--narrow class

* Add :where to lower specificity.

* Minor refactor

* Minor refactor
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.

Page section has lost its width reference
4 participants