Skip to content

Commit

Permalink
Don't enable when clicking in an editable element
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Jul 18, 2022
1 parent a633474 commit c2ed67b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { useRefEffect } from '@wordpress/compose';

export default function useClickSelection() {
return useRefEffect( ( node ) => {
function onMouseDown() {
function onMouseDown( event ) {
if ( event.target.closest( '[contenteditable]' ) !== node ) {
return;
}

node.contentEditable = true;
// Firefox doesn't automatically move focus.
node.focus();
Expand Down

0 comments on commit c2ed67b

Please sign in to comment.