AlignmentMatrixControl: simplify styles and markup#64827
Merged
Conversation
994bf2d to
59538e2
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
mirka
approved these changes
Aug 27, 2024
mirka
left a comment
Member
There was a problem hiding this comment.
Really nice cleanup, and great bug fix with the Windows High Contrast mode!
6faf7ee to
765ab40
Compare
Contributor
|
Sorry for the late reply. Just wanted to let you know that it works as expected in Windows high contrast mode too 👍 a647ab134603f1bd2c17e1158671d1de.mp49fbfaae00bd0f7427db6f19372a29360.mp4 |
bph
pushed a commit
to bph/gutenberg
that referenced
this pull request
Aug 31, 2024
* Simplify icon active cell computation * AlignmentMatrixControl: simplify styles * AlignmentMatrixControl.Icon: rewrite using SVG * Do not use `size` prop on AlignmentMatrixControl.Icon in Storybook * Cleanup * CHANGELOG * Do not type height and width explicitly * Fix typo * Inline computedWidth and computedHeight * Restore getAlignmentIndex function, since it normalizes values internally --- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
In preparation for #64723
Simplify
AlignmentMatrixControlstyles, rewriteAlignmentMatrixControl.Iconusing SVG, add better focus styles and support for Windows High Contrast mode.Why?
While working on #64723, I realized that
AlignmentMatrixControlandAlignmentMatrixControl.Iconhave some unnecessarily complex code, which made the refactor in #64723 harder than it should have been.How?
AlignmentMatrixControl:Compositeitem is styled based on thedata-active-itemattribute;COLORSvariables;AlignmentMatrixControl.Icon:sizeprop onAlignmentMatrixControl.Iconis deprecated, in favor of usingwidthandheight. This is mostly there to reflect that this icon is supposed to be used in combination with the<Icon />component (as shown in the Storybook examples and done in the editor), which accepts asizeprop itself, and internally sets thewidthandheightprops on the SVG.AlignmentMatrixControl.Iconwas done by applyingtransform: scale()via CSS — which meant that the footprint of the icon in the layout flow would stay the same (24px) regardless of thesize. With the changes in this PR, theAlignmentMatrixControl.Iconcorrectly occupies an amount of space equal to itswidthandheight.AlignmentMatrixControl.Iconnow accepts SVG-related HTML attributes, while previously it accepted HTMLdivones (this is technically a breaking change, although I don't see how consumers would be affected)Testing Instructions
trunkAlignmentMatrixControlitem when using the keyboard (and not when using mouse);AlignmentMatrixControlandAlignmentMatrixControl.Iconcan be perceived and interacted with in Windows High Contrast mode (this can also be testing by emulating theforced-colorsmedia query)AlignmentMatrixControl.Iconbeing used in a toolbar item. Clicking it will open a popover containing aAlignmentMatrixControlcomponent;Screenshots or screencast
amc.-.sb.-.trunk.mp4
amc.-.sb.-.pr.mp4
amc.-.editor.-.trunk.mp4
amc.-.editor.-.pr.mp4