Skip to content

Commit

Permalink
remove key handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
marekhrabe committed Oct 25, 2019
1 parent 1c2fffd commit 714daaa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
11 changes: 0 additions & 11 deletions packages/block-editor/src/components/link-control/input-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
import { __ } from '@wordpress/i18n';
import { IconButton } from '@wordpress/components';
import { ENTER } from '@wordpress/keycodes';

/**
* Internal dependencies
Expand All @@ -14,26 +13,16 @@ import { URLInput } from '../';
const LinkControlInputSearch = ( {
value,
onChange,
onSelect,
renderSuggestions,
fetchSuggestions,
onReset,
onKeyDown,
onKeyPress,
} ) => {
return (
<form>
<URLInput
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 }
Expand Down
7 changes: 0 additions & 7 deletions packages/block-editor/src/components/url-input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -257,7 +252,6 @@ class URLInput extends Component {
isFullWidth,
hasBorder,
__experimentalRenderSuggestions,
__experimentalOnKeyPress,
placeholder = __( 'Paste URL or type to search' ),
value = '',
autoFocus = true,
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 714daaa

Please sign in to comment.