Skip to content

Commit

Permalink
Utils: Fix focusable matching contenteditable=false (#5224)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored Mar 7, 2018
1 parent ab44213 commit cf4cc73
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion utils/focus/focusable.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const SELECTOR = [
'object',
'embed',
'area[href]',
'[contenteditable]',
'[contenteditable]:not([contenteditable=false])',
].join( ',' );

/**
Expand Down
21 changes: 21 additions & 0 deletions utils/focus/test/focusable.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,27 @@ describe( 'focusable', () => {
expect( find( map ) ).toEqual( [] );
} );

it( 'finds contenteditable', () => {
const node = createElement( 'div' );
const div = createElement( 'div' );
node.appendChild( div );

div.setAttribute( 'contenteditable', '' );
expect( find( node ) ).toEqual( [ div ] );

div.setAttribute( 'contenteditable', 'true' );
expect( find( node ) ).toEqual( [ div ] );
} );

it( 'ignores contenteditable=false', () => {
const node = createElement( 'div' );
const div = createElement( 'div' );
node.appendChild( div );

div.setAttribute( 'contenteditable', 'false' );
expect( find( node ) ).toEqual( [] );
} );

it( 'ignores invisible inputs', () => {
const node = createElement( 'div' );
const input = createElement( 'input' );
Expand Down

0 comments on commit cf4cc73

Please sign in to comment.