Skip to content

Commit

Permalink
Writing flow: avoid recalc style on every selection change (#48409)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored Feb 27, 2023
1 parent ebdf926 commit d116f9f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ function findDepth( a, b ) {
* @param {boolean} value `contentEditable` value (true or false)
*/
function setContentEditableWrapper( node, value ) {
node.contentEditable = value;
// Since we are calling this on every selection change, check if the value
// needs to be updated first because it trigger the browser to recalculate
// style.
if ( node.contentEditable !== String( value ) )
node.contentEditable = value;
// Firefox doesn't automatically move focus.
if ( value ) node.focus();
}
Expand Down

1 comment on commit d116f9f

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in d116f9f.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4286449936
📝 Reported issues:

Please sign in to comment.