-
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
Update Zoom Out for document width parity #65814
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3cd5c19
Factor `frameSize` into scaling and document width styling
stokesman 167d5f2
Avoid decimals for pixel precision
stokesman f86a7cc
Fix testing for number type of `frameSize`
stokesman 7a24f82
Revise comment about `frameSize` in scale calculation
stokesman 1374d0b
Restore `frameSize` counter-scaling for non-pixel values
stokesman b542ae4
Remove unused CSS variable
stokesman 696c0d5
Revise comment again
stokesman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
when are we not in any of these conditions?
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.
We, as in core, never.
frameSize
is a public prop and given thatVisualEditor
specifies it as as'48px'
some third-party could conceivably have the notion that any CSS unit could be used and be passing'2em'
. I revised the comment preceding this to hopefully clarify.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.
The
IFrame
component is a public API, so it could have, in theory, already been used by a third-party with a non-pixel value. Making this a breaking change.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.
Thanks for commenting. I think this is not a breaking change. The
frameSize
never gets left out of the applied styles, it just doesn’t get factored into the "default" scale calculation when it can’t be treated as pixels. That’s how it was for any value before this.I did, thanks to your comment, reexamine everything and realized the second commit here was preventing a non-pixel
frameSize
from being counter-scaled in the styles. So I pushed a 1374d0b to restore that. I’d be pleased to find a way to improve the poetry here and will look for a better refactor.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 think I see what you're saying, but the effect for consumers that were using non-pixel units is still broken with this PR as it no longer adds horizontal padding for non-pixel units like trunk, thus the breaking change.
My comment was mostly just a gut feeling from having read the code which is why it didn't have that much context. You had me reexamine my assumptions too, so I do appreciate that.
I figured we could move your
frameWidth
calculation to CSS to get around the issue, so I dug into that and found out that CSS could not actually handle the math for units; my assumption was wrong.The division operator in CSS
calc()
doesn't do the dimensional analysis of first converting units to pixels and then getting the ratio of them.I've been wracking my brain to think of ways to support units so that it isn't a breaking change because including the
frameSize
is important for calculating the scale.I suppose a loophole for the backwards compatibility argument could be that nothing about the prop was documented, so you could argue that the previous API accepted only numbers or pixel strings rather than any CSS unit.
I think I'm okay with that as long as we add documentation for the
px
requirement now even if it will break non-px usage that may exist.