-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Remove data-align divs for themes that support layout #38613
Changes from all commits
e537502
095a55c
778077c
2fbef4d
ddec7ac
f096a08
e12ac14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,31 +115,33 @@ export default { | |
let output = | ||
!! contentSize || !! wideSize | ||
? ` | ||
${ appendSelectors( selector, '> *' ) } { | ||
${ appendSelectors( selector, '> :not(.alignleft):not(.alignright)' ) } { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed this that way the auto margins don't apply to left/right aligned blocks. Otherwise, the margins we had specifically for these blocks didn't apply at all. I think this has some small potential to impact FSE themes for aligned left/right blocks but this restores the original intent basically. I think it's fine but also curious about testing impact here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess also the "max-width" rule should be moved here maybe, let me know what you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @jasmussen did you see this, any thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be sure I understand right, the desired behavior is that a floated image is omitted from max width and auto margins, so that it's up to a theme to decide whether it should be part of the main column, or not. Is that right? If so, then that appears to work fairly well in this branch: However, look at the first paragraph in that screenshot above, it no longer has a max-width for some reason, whereas it does in trunk: Based on later comments in Maggie's testing content, it sounds like this is could be correct: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes I want to exclude left/right aligned blocks from the auto margins and the max width. But it's not up to the theme to decide whether it should be part of the main column. It can't be part of the main column at all. If you want something to be part of the main column, you need to wrap it in a group. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, sounds good to me. Did you see the Paragraph missing a max-width, issue, though? That's present in this branch but not in trunk. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it was actually a missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. I wonder if this would work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jasmussen's suggestion solves the alignment issue for me |
||
max-width: ${ contentSize ?? wideSize }; | ||
margin-left: auto !important; | ||
margin-right: auto !important; | ||
} | ||
|
||
${ appendSelectors( selector, '> [data-align="wide"]' ) } { | ||
${ appendSelectors( selector, '> .alignwide' ) } { | ||
max-width: ${ wideSize ?? contentSize }; | ||
} | ||
|
||
${ appendSelectors( selector, '> [data-align="full"]' ) } { | ||
${ appendSelectors( selector, '> .alignfull' ) } { | ||
max-width: none; | ||
} | ||
` | ||
: ''; | ||
|
||
output += ` | ||
${ appendSelectors( selector, '> [data-align="left"]' ) } { | ||
${ appendSelectors( selector, '> .alignleft' ) } { | ||
float: left; | ||
margin-right: 2em; | ||
margin-left: 0; | ||
} | ||
|
||
${ appendSelectors( selector, '> [data-align="right"]' ) } { | ||
${ appendSelectors( selector, '> .alignright' ) } { | ||
float: right; | ||
margin-left: 2em; | ||
margin-right: 0; | ||
} | ||
|
||
`; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,9 @@ | |
width: 100%; | ||
} | ||
|
||
&.alignleft, | ||
&.alignright, | ||
&.aligncenter, | ||
.alignleft, | ||
.alignright, | ||
.aligncenter { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to add this as a class instead of sticking to the data attributes or inline layout styles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline layout styles target these classes. This matches the markup in the frontend.