зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1574439 - The search input should focus when Search panel is opened; r=nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D42471 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
938483d542
Коммит
7249733689
|
@ -58,6 +58,12 @@ class SearchPanel extends Component {
|
|||
this.provider = SearchProvider;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (this.searchboxRef) {
|
||||
this.searchboxRef.current.focus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom TreeView label rendering. The search result
|
||||
* value isn't rendered in separate column, but in the
|
||||
|
|
|
@ -76,7 +76,7 @@ class SearchBox extends PureComponent {
|
|||
});
|
||||
this.shortcuts.on(this.props.keyShortcut, event => {
|
||||
event.preventDefault();
|
||||
this.inputRef.current.focus();
|
||||
this.focus();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,12 @@ class SearchBox extends PureComponent {
|
|||
}
|
||||
}
|
||||
|
||||
focus() {
|
||||
if (this.inputRef) {
|
||||
this.inputRef.current.focus();
|
||||
}
|
||||
}
|
||||
|
||||
onChange(inputValue = "") {
|
||||
if (this.state.value !== inputValue) {
|
||||
this.setState({
|
||||
|
|
Загрузка…
Ссылка в новой задаче