Skip to content

Commit

Permalink
Merge pull request #6241 from aschlaep/fix-documentsearch-refocus
Browse files Browse the repository at this point in the history
Fix re-focus on ctrl+f when search overlay is already open
  • Loading branch information
ian-r-rose committed Apr 26, 2019
2 parents f40af6c + 09684ee commit 10ac1a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/documentsearch/src/searchinstance.ts
Expand Up @@ -67,9 +67,11 @@ export class SearchInstance implements IDisposable {
*/
focusInput(): void {
this._displayState.forceFocus = true;
this._displayState.searchInputFocused = true;

// Trigger a rerender without resetting the forceFocus.
this._displayUpdateSignal.emit(this._displayState);
this._displayState.forceFocus = false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/documentsearch/src/searchoverlay.tsx
Expand Up @@ -73,7 +73,7 @@ class SearchEntry extends React.Component<ISearchEntryProps> {
}

componentDidUpdate() {
if (this.props.forceFocus && this.props.inputFocused) {
if (this.props.forceFocus) {
this.focusInput();
}
}
Expand Down

0 comments on commit 10ac1a7

Please sign in to comment.