diff --git a/blocks/editable/tinymce.js b/blocks/editable/tinymce.js index 424c14c630e663..26e762cd72ecba 100644 --- a/blocks/editable/tinymce.js +++ b/blocks/editable/tinymce.js @@ -47,9 +47,9 @@ export default class TinyMCE extends Component { const { removedKeys, updatedKeys } = diffAriaProps( this.props, nextProps ); removedKeys.forEach( ( key ) => - this.editorNode.removeAttribute( key ) ); + this.editorNode.removeAttribute( key ) ); updatedKeys.forEach( ( key ) => - this.editorNode.setAttribute( key, nextProps[ key ] ) ); + this.editorNode.setAttribute( key, nextProps[ key ] ) ); } componentWillUnmount() { diff --git a/editor/utils/dom.js b/editor/utils/dom.js index 4fdd0b305209c4..d28c927cf799d9 100644 --- a/editor/utils/dom.js +++ b/editor/utils/dom.js @@ -164,11 +164,11 @@ export function placeCaretAtHorizontalEdge( container, isReverse ) { if ( includes( [ 'INPUT', 'TEXTAREA' ], container.tagName ) ) { container.focus(); if ( isReverse ) { - container.selectionStart = 0; - container.selectionEnd = 0; - } else { container.selectionStart = container.value.length; container.selectionEnd = container.value.length; + } else { + container.selectionStart = 0; + container.selectionEnd = 0; } return; } diff --git a/editor/utils/test/dom.js b/editor/utils/test/dom.js index dabba4b5513e61..9ddd979e0d4d28 100644 --- a/editor/utils/test/dom.js +++ b/editor/utils/test/dom.js @@ -81,14 +81,14 @@ describe( 'DOM', () => { const input = document.createElement( 'input' ); input.value = 'value'; placeCaretAtHorizontalEdge( input, true ); - expect( isHorizontalEdge( input, true ) ).toBe( true ); + expect( isHorizontalEdge( input, false ) ).toBe( true ); } ); it( 'should place caret at the end of the input', () => { const input = document.createElement( 'input' ); input.value = 'value'; placeCaretAtHorizontalEdge( input, false ); - expect( isHorizontalEdge( input, false ) ).toBe( true ); + expect( isHorizontalEdge( input, true ) ).toBe( true ); } ); } ); } );