Skip to content
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

Resizable Editor: Make the editor resizable with arrow keys #65546

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export default function ResizeHandle( { direction, resizeWidthBy } ) {
function handleKeyDown( event ) {
const { keyCode } = event;

if ( keyCode !== LEFT && keyCode !== RIGHT ) {
return;
}
event.preventDefault();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a comment referencing this issue, or do you think it's a common practice? I think maybe it's fine to leave it to git blaming to do its work 😅.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we want to add our own event to an event, it is common to add event.preventDefault(), and there are a lot of uncommented event.preventDefault() in Gutenberg 😅 Therefore, I personally think that a comment is unnecessary.


if (
( direction === 'left' && keyCode === LEFT ) ||
( direction === 'right' && keyCode === RIGHT )
Expand Down
Loading