-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Modal: Add small top padding to the content so that avoid cutting off the visible outline when hovering items #51829
Conversation
Size Change: -23 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
Since Gutenberg 16.1 has already been released, I have added the backport label just in case. |
Relevant: #51806. CC: @jameskoster |
If we split the padding then the stroke which appears beneath the header on scroll might look a bit close to the title text. Adding 4px padding-top to |
This problem will always occur when a focusable element, such as a button, textbox, etc., is placed at the beginning of the modal content. Therefore, it might be a good idea to add slight padding to the top of the modal content. Is there any problem with the approach of adding a slight padding at the top of the |
I understand the problem, but we shouldn't be using internal components classnames (like Couldn't we add small |
Thanks for the advice, @ciampo.
I would like to try the latter method so that we don't have to add |
dcc5ec1
to
7e91b1e
Compare
Flaky tests detected in c91ada2. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5385980149
|
I have changed this PR as follows:
As a result, the target to be fixed by this PR has changed. Please see details in the description of the updated PR. |
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.
LGTM, although I'll let Jay/Joen give the final green light
@@ -130,7 +130,7 @@ | |||
.components-modal__content { | |||
flex: 1; | |||
margin-top: $header-height + $grid-unit-15; | |||
padding: 0 $grid-unit-40 $grid-unit-40; | |||
padding: $border-width-focus-fallback $grid-unit-40 $grid-unit-40; |
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.
It may be worth to add a short inline comment explaining the reason for the top padding
The Bottom padding is 12pxBottom padding is 8pxThe approach of changing the top padding of the modal content from 2px to 4px seems to have less visual impact. What do you think? |
I have made the following changes:
This looks fine to me. Below are some screenshots. |
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 visible outline when hovering items (#51829) * Site Editor: Fix focus cutoff in add template modal * Add padding-top to the modal content * Remove unnecessary padding-top * Remove unnecessary padding-top * Update changelog * Revert top padding from block patterns list * Revert top padding from block patterns list * Remove unnecessary changes * Remove unnecessary changes * Add CSS inline comment * Change padding metrics
I just cherry-picked this PR to the add/pre-beta1-bugfixes branch to get it included in the next release: 4f3599d |
* Restore sidebar in focus mode on Pattern click through in Browse Mode Library (#51897) Brings back #51492 * [Command center]: Add preferences and keyboard shortcuts commands (#51862) * [Command center]: Add preferences and keyboard shortcuts commands * update labels * [Site Editor]: Fix `library` command path (#51837) * Updating social link attributes (#51997) * Try: Update template titles (#51428) * Update template titles * Fix typo Co-authored-by: Alex Stine <[email protected]> * Revert Index rename * "front page" -> "homepage" * Update 404 Page make more sense given the template appears in the Pages panel too. * Front Page * home title + description * Revert Home name change, and move compat files * separate code for wp versions * update tests --------- Co-authored-by: Alex Stine <[email protected]> Co-authored-by: ntsekouras <[email protected]> * Update text color (#51965) * Modal: Add small top padding to the content so that avoid cutting off the visible outline when hovering items (#51829) * Site Editor: Fix focus cutoff in add template modal * Add padding-top to the modal content * Remove unnecessary padding-top * Remove unnecessary padding-top * Update changelog * Revert top padding from block patterns list * Revert top padding from block patterns list * Remove unnecessary changes * Remove unnecessary changes * Add CSS inline comment * Change padding metrics * Rest API: rename navigation fallback classes from WP_ to Gutenberg_ (#51959) * The `WP_REST_Navigation_Fallback_Controller` class has been committed to core and therefore results in a naming conflict and unit test failures. Ideally `WP_REST_Navigation_Fallback_Controller` should have been named `WP_REST_Navigation_Fallback_Controller_Gutenberg` and extended `WP_REST_Navigation_Fallback_Controller`. But we can conditionally load the file instead. * Renamed WP_Classic_To_Block_Menu_Converter to Gutenberg_Classic_To_Block_Menu_Converter Load WP_REST_Navigation_Fallback_Controller dependencies in load.php * Renamed all 6.3 classes to have the Gutenberg_ prefix. This should avoid compat errors and hopefully some confusion later. * Also rename test files for completeness * Updated deprecation notices to refer to Gutenberg classes * Fix phpunit failures (#51950) * Fix phpunit failures * Add comment * Update comment with actual reason this fix works --------- Co-authored-by: Dave Smith <[email protected]> Co-authored-by: Nik Tsekouras <[email protected]> Co-authored-by: Ramon <[email protected]> Co-authored-by: James Koster <[email protected]> Co-authored-by: Alex Stine <[email protected]> Co-authored-by: Aki Hamano <[email protected]> Co-authored-by: Robert Anderson <[email protected]>
… the visible outline when hovering items (WordPress#51829) * Site Editor: Fix focus cutoff in add template modal * Add padding-top to the modal content * Remove unnecessary padding-top * Remove unnecessary padding-top * Update changelog * Revert top padding from block patterns list * Revert top padding from block patterns list * Remove unnecessary changes * Remove unnecessary changes * Add CSS inline comment * Change padding metrics
Update:
This PR originally tried to fix the cutoff when focusing on an item in the "Add template" modal. However, with #51806, the text now appears above the item and I have confirmed that this problem no longer occours.
However, the same problem occurs when there is a focusable element at the beginning of the modal content. Therefore, I decided to add 2px top padding to the content of the modal component itself.
What?
This PR adds 2px top padding to the content of the
Modal
component. This prevents the problem of the outline being cut off in advance when a focusable element is inserted into the modal content.How?
Use the
$border-width-focus-fallback
variable to add 2px padding to the top of the modal content.Testing Instructions
Rename Navigation Modal
Choose Pattern Modal
I have found that adding top padding to the Modal component itself fixes the outline cut-off in the following two existing modals:
These modals already have 2px top padding to prevent outline cutting on focus. However, when focused, the outlines are extended by an additional 2px due to the offset, resulting in the outlines being cut off. By adding top padding to the modal component itself, it now has a total of 4px top padding, which also fixes the outline cutoff on focus.