Prechádzať zdrojové kódy

Merge pull request #6241 from aschlaep/fix-documentsearch-refocus

Fix re-focus on ctrl+f when search overlay is already open
Ian Rose 6 rokov pred
rodič
commit
10ac1a7d91

+ 2 - 0
packages/documentsearch/src/searchinstance.ts

@@ -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;
   }
 
   /**

+ 1 - 1
packages/documentsearch/src/searchoverlay.tsx

@@ -73,7 +73,7 @@ class SearchEntry extends React.Component<ISearchEntryProps> {
   }
 
   componentDidUpdate() {
-    if (this.props.forceFocus && this.props.inputFocused) {
+    if (this.props.forceFocus) {
       this.focusInput();
     }
   }