-
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
List View: Fix focus outline style #69201
base: trunk
Are you sure you want to change the base?
Conversation
Size Change: -95 B (-0.01%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
16b84d8
to
56d6150
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. |
Flaky tests detected in 56d6150. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/13330223611
|
What?
Closes #69189
This PR will ensure that the correct focus style is applied regardless of where the ListView component is used.
Why?
A list view item consists of two cells, the second cell is expected to be 28px wide. This 28px is the combined value of the dropdown toggle button width (
24px
) + right padding (4px
):However, for blocks that don't allow dropdown toggles, only an empty cell will be rendered. The cell itself has a width of
24px
.In the post editor, the
box-sizing
value of this cell is the browser's defaultcontent-box
, so the cell width is24px + 4px right padding = 28px
, which means no outline shift.On the other hand, in the site editor, the
box-sizing
value of this cell isborder-box
, which means the cell has a width of24px
.The fact that the cell is
24px
wide instead of the expected28px
will cause the absolutely positioned focus to shift right.How?
24px
in size. To get around this, addsize:small
to thetoggleProps
. As a result, remove the CSS override, which is no longer needed.Testing Instructions
Go to the following places where list views are used:
Make sure all styles are applied correctly:
Screenshots or screencast
In the screenshot below, I've applied some pseudo styles.
Site Editor > Pages Menu > Page
Site Editor > Navigation Menu
The selected and focused item is resolved.
Site Editor > Navigation Block > Block Sitebar > Settings Tab
No visual changes.