fix: ignore input elements except in search (#37145)

This commit is contained in:
Oliver Eyton-Williams
2019-10-09 15:58:31 +02:00
committed by mrugesh
parent 2955bbeb4f
commit 52653c57fc

View File

@ -4,7 +4,7 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { createSelector } from 'reselect';
import { SearchBox } from 'react-instantsearch-dom';
import { HotKeys, configure } from 'react-hotkeys';
import { HotKeys, ObserveKeys } from 'react-hotkeys';
import { isEqual } from 'lodash';
import {
@ -19,9 +19,6 @@ import SearchHits from './SearchHits';
import './searchbar-base.css';
import './searchbar.css';
// Configure react-hotkeys to work with the searchbar
configure({ ignoreTags: ['select', 'textarea'] });
const propTypes = {
innerRef: PropTypes.object,
isDropdownEnabled: PropTypes.bool,
@ -187,14 +184,16 @@ class SearchBar extends Component {
<label className='fcc_sr_only' htmlFor='fcc_instantsearch'>
Search
</label>
<SearchBox
focusShortcuts={[83, 191]}
onChange={this.handleChange}
onFocus={this.handleFocus}
onSubmit={this.handleSearch}
showLoadingIndicator={true}
translations={{ placeholder }}
/>
<ObserveKeys>
<SearchBox
focusShortcuts={[83, 191]}
onChange={this.handleChange}
onFocus={this.handleFocus}
onSubmit={this.handleSearch}
showLoadingIndicator={true}
translations={{ placeholder }}
/>
</ObserveKeys>
{isDropdownEnabled && isSearchFocused && (
<SearchHits
handleHits={this.handleHits}