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
Editor: Unify the list view shortcut registration and definition #57200
Conversation
Size Change: -420 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
screen.getByRole( 'dialog', { | ||
name: 'Keyboard shortcuts', | ||
} ) | ||
).toMatchSnapshot(); |
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 a useless test (we just update the snapshot when it changes)
4690981
to
3984e1c
Compare
I think the Opportunity for more unification 😄 |
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 the edit-site package doesn't register global shortcuts from the editor package (EditorKeyboardShortcuts); this is the reason e2e tests are failing.
Thanks @Mamaduka, that makes sense! And it's consistent with manual testing (CTRL+Option+o opens the list view in the post editor but not the site editor for me with this PR applied).
Flaky tests detected in 6c8e4cb. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7273491562
|
@@ -101,16 +99,6 @@ function KeyboardShortcuts() { | |||
}, | |||
} ); | |||
|
|||
registerShortcut( { | |||
name: 'core/edit-post/toggle-list-view', |
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 guess unregistering this won't work anymore? Anyway, I think that's fine :)
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.
Works :)
Related #52632
What?
This is a small refactor to unify the list view keyboard shortcut definition between the site and post editors, since now the state has moved to the editor package.
Testing Instructions
1- You can open and close the list view using the shortcut