Skip to content

Commit

Permalink
Block Editor: Typewriter: Skip entire component for IE (#20485)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth authored and jorgefilipecosta committed Mar 2, 2020
1 parent d3eadc1 commit d9b66e0
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions packages/block-editor/src/components/typewriter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,6 @@ class Typewriter extends Component {
}

render() {
// There are some issues with Internet Explorer, which are probably not
// worth spending time on. Let's disable it.
if ( isIE ) {
return this.props.children;
}

// Disable reason: Wrapper itself is non-interactive, but must capture
// bubbling events from children to determine focus transition intents.
/* eslint-disable jsx-a11y/no-static-element-interactions */
Expand All @@ -261,12 +255,23 @@ class Typewriter extends Component {
}
}

/**
* The exported component. The implementation of Typewriter faced technical
* challenges in Internet Explorer, and is simply skipped, rendering the given
* props children instead.
*
* @type {WPComponent}
*/
const TypewriterOrIEBypass = isIE
? ( props ) => props.children
: withSelect( ( select ) => {
const { getSelectedBlockClientId } = select( 'core/block-editor' );
return { selectedBlockClientId: getSelectedBlockClientId() };
} )( Typewriter );

/**
* Ensures that the text selection keeps the same vertical distance from the
* viewport during keyboard events within this component. The vertical distance
* can vary. It is the last clicked or scrolled to position.
*/
export default withSelect( ( select ) => {
const { getSelectedBlockClientId } = select( 'core/block-editor' );
return { selectedBlockClientId: getSelectedBlockClientId() };
} )( Typewriter );
export default TypewriterOrIEBypass;

0 comments on commit d9b66e0

Please sign in to comment.