Search: autofocus

profile-avatar-switcher
Alex Gleason 2021-10-14 12:38:52 -05:00
rodzic 4dbc4247f1
commit e36dc0d119
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 8 dodań i 2 usunięć

Wyświetl plik

@ -57,9 +57,14 @@ class Search extends React.PureComponent {
onClear: PropTypes.func.isRequired, onClear: PropTypes.func.isRequired,
onShow: PropTypes.func.isRequired, onShow: PropTypes.func.isRequired,
openInRoute: PropTypes.bool, openInRoute: PropTypes.bool,
autoFocus: PropTypes.bool,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
}; };
static defaultProps = {
autoFocus: false,
}
state = { state = {
expanded: false, expanded: false,
}; };
@ -100,7 +105,7 @@ class Search extends React.PureComponent {
} }
render() { render() {
const { intl, value, submitted } = this.props; const { intl, value, autoFocus, submitted } = this.props;
const { expanded } = this.state; const { expanded } = this.state;
const hasValue = value.length > 0 || submitted; const hasValue = value.length > 0 || submitted;
@ -117,6 +122,7 @@ class Search extends React.PureComponent {
onKeyUp={this.handleKeyUp} onKeyUp={this.handleKeyUp}
onFocus={this.handleFocus} onFocus={this.handleFocus}
onBlur={this.handleBlur} onBlur={this.handleBlur}
autoFocus={autoFocus}
/> />
</label> </label>
<div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}> <div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>

Wyświetl plik

@ -12,7 +12,7 @@ const messages = defineMessages({
const Search = ({ intl }) => ( const Search = ({ intl }) => (
<div className='column search-page'> <div className='column search-page'>
<ColumnHeader icon='search' title={intl.formatMessage(messages.heading)} /> <ColumnHeader icon='search' title={intl.formatMessage(messages.heading)} />
<SearchContainer autoSubmit /> <SearchContainer autoFocus autoSubmit />
<SearchResultsContainer /> <SearchResultsContainer />
</div> </div>
); );