-
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
Button block: support double enter to skip to default block #56134
Conversation
@@ -47,6 +53,62 @@ const LINK_SETTINGS = [ | |||
}, | |||
]; | |||
|
|||
function useEnter( props ) { |
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 was wondering if we could reuse the same hook/code as the list block. It's probably doable but maybe @ellatrix would know more how to better organize these things. So I'm leaving this out of this 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.
Is it copied over straight from list? Maybe we could temporality move it to a utils file to avoid the duplication until there's an api for it?
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 copied it and remove some list specific stuff.
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.
But yes, what @Mamaduka said, we can incorporate it into a setting like __experimentalOnEnter
later.
Size Change: +244 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
Maybe |
I'll try to check this soon. Interested about accessibility here. |
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 well for me, it's the same behaviour as list.
Thanks for the reviews and happy to address follow-ups if needed. |
What?
When trying to use keyboard only to write a post with some buttons and lists, I always get stuck in the buttons block, I write my button text but then don't know how to break out of it to continue just writing. I always try the same technique we do for lists (double enter) but it use to not work on the button block.
I'm not sure if I'm the only one that asked for this but this PR implements this small writing flow improvement (IMO) and matches the behavior of the list block in two ways:
How?
I basically copy/pasted the hook from the button block and adapted it a little bit.
Testing Instructions
1- Create a buttons block.
2- Hit double enter at the end. (try in the middle two).