-
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
Improve media & text block on IE. #10812
Conversation
26b99d2
to
dd6f103
Compare
grid-area: resizer; | ||
-ms-grid-column: 1; | ||
-ms-grid-column-span: 2; | ||
-ms-grid-row: 2; |
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.
Instead of adding this mse specific styles here, can we just enable grid: true
in autoprefixer config?
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.
Hi @youknowriad, I agree using the autoprefixer is an awesome idea and makes the code simpler.
I did some tests, and the template areas we had were not working even with the autoprefixer, setting columns spans using grid-column: 1 / -1; also did not work but using grid-column: 1 / span 2; works.
It looks like with this changes to the CSS and using the autoprefixer things are working fine in more modern browsers and in IE11, without having IE prefixes around the code.
Thank you for the suggestion.
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.
I don't see the change to the autoprefixer config in the changes? Is it already enabled?
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.
Sorry, I missed a stash on the change, the problem was corrected.
dc9dfa8
to
66ed56e
Compare
@jorgefilipecosta this branch has merge conflicts and needs to be refreshed. It seems like it never to reviewed. Can you bring it up to date and remove |
66ed56e
to
7c7b6c6
Compare
7c7b6c6
to
1d26630
Compare
Hi @gziolo this PR was rebased and updated to work with the new "Media & Text" functionalities like the stack on mobile. |
const style = { | ||
gridTemplateColumns: 'right' === mediaPosition ? `auto ${ widthString }` : `${ widthString } auto`, | ||
gridTemplateColumns, | ||
msGridColumns: gridTemplateColumns, |
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.
Note that style attributes must be whitelisted. This was missed for grid-template-columns
previously, and can result in invalidated blocks for non-administrator users.
See also: https://core.trac.wordpress.org/ticket/46597
We should probably add a filter to include -ms-grid-columns
for the safe_style_css
set in the plugin, and propose a complementing upstream Trac ticket once this is merged.
https://developer.wordpress.org/reference/hooks/safe_style_css/
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.
Hi @aduth, this PR is not changing the block save function/markup of the block. At the time (before 5.0 release) in talks with @mtias it was discussed if we should add an IE specific style to the block inline styles and we decided not to do it. The disadvantage is that on the website frontend the image always appears at 50% width, on the backend we add the correct style so it appears on the correct width.
Given that we are not adding -ms-grid-columns on the save function I don't think there is a need to update filters compared to what we are already doing on the patches available at https://core.trac.wordpress.org/ticket/46597.
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.
this PR is not changing the block save function/markup of the block
Ah, you're right. Sorry, I missed that.
I guess it makes me wonder then what's the purported benefit, if we're only solving the issue in the editor, but not on the front-end. To me, it would seem the latter would be the more important anyways. At the very least, should it not be marked as fixing #11577 ?
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.
Currently, the block does not work in IE (front-end and editor), the media element and the content don't event appear side by side. This PR fixes most of the problems on the front end (in the editor fixes all of them). The layout appears side by side the vertical-align options work, the background position change works, the only thing that does not work is the resizing on the front end (e.g: things appear always with the default 50% width), compared to the current state is a big improvement. Issue #11577 says "Media & Text block is not aligning in IE 11" and I guess that problem is fixed the alignments work as expected, maybe we can close and add a comment specifying that just the resizing functionality does not work on the front end.
1d26630
to
0ef748a
Compare
@jorgefilipecosta, what's the status here? Thanks! |
0ef748a
to
6c7efc1
Compare
Hi @tyrann0us, this rebased and updated. It is waiting for a review in order to be merged. |
6c7efc1
to
566d358
Compare
566d358
to
dc87785
Compare
This PR was updated and should be ready just needs a review. |
dc87785
to
61b1925
Compare
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.
Seems to work well in my testing.
Squashed commits: [48c530fcb] Improve media&text block on IE.
61b1925
to
4c7a142
Compare
Squashed commits: [48c530fcb] Improve media&text block on IE.
Description
Fixes: #11577
Grid layout on ie has some special needs.
This PR applies a series of changes to get to a point where the main block problems on IE are mostly solved.
The autoprefixer configuration was updated to support grid prefixes.
The remaining problem on IE is that on the frontend the media & content always appear at 50% width. The way to solve this problem would require that we set an IE-specific inline style on the markup of the block. So we would be transferring more bytes over the wire for all the users to fix the problem in this browser, so I opted to leave this change out. In my option, the resizing can be seen as a progressive enhancement.
Screenshots:
Before:
After: