From 714daaaba1fe51ac6e6a316acf6adfcc1d0826e7 Mon Sep 17 00:00:00 2001 From: Marek Hrabe Date: Fri, 25 Oct 2019 18:17:07 +0200 Subject: [PATCH] remove key handlers --- .../src/components/link-control/input-search.js | 11 ----------- .../block-editor/src/components/url-input/index.js | 7 ------- 2 files changed, 18 deletions(-) diff --git a/packages/block-editor/src/components/link-control/input-search.js b/packages/block-editor/src/components/link-control/input-search.js index 913f784c5ff433..eaaf0c8123331f 100644 --- a/packages/block-editor/src/components/link-control/input-search.js +++ b/packages/block-editor/src/components/link-control/input-search.js @@ -4,7 +4,6 @@ */ import { __ } from '@wordpress/i18n'; import { IconButton } from '@wordpress/components'; -import { ENTER } from '@wordpress/keycodes'; /** * Internal dependencies @@ -14,12 +13,9 @@ import { URLInput } from '../'; const LinkControlInputSearch = ( { value, onChange, - onSelect, renderSuggestions, fetchSuggestions, onReset, - onKeyDown, - onKeyPress, } ) => { return (
@@ -27,13 +23,6 @@ const LinkControlInputSearch = ( { className="block-editor-link-control__search-input" value={ value } onChange={ onChange } - __experimentalOnKeyDown={ ( event, suggestion ) => { - if ( event.keyCode === ENTER ) { - onSelect( suggestion )( event ); - } - onKeyDown( event, suggestion ); - } } - __experimentalOnKeyPress={ onKeyPress } placeholder={ __( 'Search or type url' ) } __experimentalRenderSuggestions={ renderSuggestions } __experimentalFetchLinkSuggestions={ fetchSuggestions } diff --git a/packages/block-editor/src/components/url-input/index.js b/packages/block-editor/src/components/url-input/index.js index 4b1ea841edc793..75999752155d46 100644 --- a/packages/block-editor/src/components/url-input/index.js +++ b/packages/block-editor/src/components/url-input/index.js @@ -138,11 +138,6 @@ class URLInput extends Component { onKeyDown( event ) { const { showSuggestions, selectedSuggestion, suggestions, loading } = this.state; - // Trigger `onKeyDown` event, passing the selected suggestion besides the event class. - if ( isFunction( this.props.__experimentalOnKeyDown ) ) { - this.props.__experimentalOnKeyDown( event, selectedSuggestion ); - } - // If the suggestions are not shown or loading, we shouldn't handle the arrow keys // We shouldn't preventDefault to allow block arrow keys navigation if ( ! showSuggestions || ! suggestions.length || loading ) { @@ -257,7 +252,6 @@ class URLInput extends Component { isFullWidth, hasBorder, __experimentalRenderSuggestions, - __experimentalOnKeyPress, placeholder = __( 'Paste URL or type to search' ), value = '', autoFocus = true, @@ -306,7 +300,6 @@ class URLInput extends Component { onInput={ stopEventPropagation } placeholder={ placeholder } onKeyDown={ this.onKeyDown } - onKeyPress={ isFunction( __experimentalOnKeyPress ) ? __experimentalOnKeyPress : undefined } role="combobox" aria-expanded={ showSuggestions } aria-autocomplete="list"