-
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
Adds dimension controls to Group Block #16730
Closed
Closed
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
1567db0
Adds basic dimension controls to Group Block
getdave b072dd6
Moves Dim Control to block editor package. Makes size class based rat…
getdave e75ac86
Moves sizes config to seperate file. Introduces tooltip on size buttons
getdave 851272d
Adds aria pressed support to size buttons
getdave e8ea617
Improve i18n of strings.
getdave cca7e68
Renames Huge to Xlarge and adds ability to provide abbr for a11y reasons
getdave dbd6cdb
Adds reset button to UI
getdave 0574e47
Align UI closer to mockup provided by @kjell
getdave 672c51b
Add Responsive Controls and Attributes
getdave d59d196
Move Group Inspector to dedicated component
getdave e63ed10
Remove dependence on clientID to make component more portable and gen…
getdave 4babcb6
Adds doc blocks
getdave f26ad45
Moves findSizeBySlug util function into sizes file
getdave 11b476c
Adds basics tests
getdave 7d92083
Adds component docs
getdave 45f7aa1
Update to decouple DimensionControl component from knowledge of Block…
getdave d1b3aa8
Utilise withInstanceId HOC to remove need for id prop
getdave 5d5d198
Updates size buttons for improved comprehension and a11y
getdave d30b760
Updates UI in response to designer feedback
getdave f94a15e
Update to utilise dropdown for UI. Improve alignment. Move toggle bel…
getdave 28ca9b4
Remove duplicate Dimension Control
getdave 8d41a49
Refactor dimension controls to use new experimental components
getdave 9923154
Removes Dimension Control docs
getdave cc3277b
Updates to handle resetting values when toggling responsive mode.
getdave ad7325b
Adds icons to padding controls
getdave 325c45a
Remove “screens” from viewport labels as already in aria description
getdave 08d1dee
Fix to ensure labels and fields align right hand edges correctly
getdave 3f9579a
Removes responsive setup
getdave 4095617
Remove all responsive CSS styles
getdave e200219
Add margin and i18n
getdave 44575ec
Adds help text to Dimension Control block
getdave 223ee9a
Adds help notice to Margin controls.
getdave fd3741f
Update snapshots.
getdave 3c96458
Updates to coolocate all attributes in block.json
getdave 9ad9c74
Update full content integration tests
getdave e849702
Remove unwanted help text
getdave af88337
Restore enhancements lost during rebase
getdave 3f516ae
Revert unwanted change to Responsive Controls
getdave 7678379
Remove random new line
getdave a9bed02
Remove deprecated file reintroduced via rebase
getdave 0a6eec9
Adds help text to controls
getdave cec67bf
Add padding and margin to saved Block for use on frontend
getdave f6ec10c
Add subtle animation to margin/padding within Editor only
getdave 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
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
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
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
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.
This is going to be really difficult for themes to override if they need to: there are a ton of different breakpoint/margin/padding combinations, and I worry that the theme would essentially need to rewrite all of them. This should work out of the box in many themes (it seems to be okay in Twenty Nineteen based on my testing), but will definitely break some too. For instance, allowing users to adjust the margins in the Gutenberg starter theme causes it to completely fall apart, since it relies on all blocks having
auto
left and right margins. For that reason, I wonder if this is this "Allow users to control margin and padding for individual blocks" is something that themes opt-in to? Similar to how they opt into wide alignments currently.On a related note, most themes won't actually use the exact same breakpoints we use here. In #13363, we talked about potentially allowing themes to specify breakpoints for each of these devices. I'm not sure how/if that would best be implemented though. 🤔
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've got to be honest, I've kind of hacked this in, in the hope that someone more famliar with Themes can advise on how best to implement to keep specificity down and allow Themes to extend. I'd greatly value any commits you'd like to push in this direction.
Oh god, I didn't think of that. Of course, the Block Editor uses standard breakpoints, but Themes will choose their own.
I agree that we need a way to allow users to opt-in and to specify breakpoints. This seems like a wider project.
What route do we have to allow an initial MVP implementation of Block spacing to be shipped? Or do we need to get the breakpoint registration stuff done first?
Thanks!
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'll have to think about this a little bit. I wonder if @allancole, @laurelfulford, or @davidakennedy has any thoughts too. In general, I think we'll have much more leeway if we make this an opt-in for themes.
I wonder if shipping the automatically-responsive spacing makes the most sense as an MVP. Then we can tackle the breakpoint-specific settings alongside theme-supplied breakpoints in a separate, wider issue.
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 👍
Agreed and I think this is what I will do. So MVP will ship with basic controls (no responsive). Then I'll work on branches for
<DimensionControl />
component (as seen here)Then when we've had a chance to think about the impact of responsive settings on Themes we can look to bring it all together.
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 is this in the
theme.scss
file if it is an editor-only style?