({ exitEventIsEnter, exitEventIsEscape })
| 136 | |
| 137 | // These parameters describe the reason find mode is exiting, and come from the HUD UI component. |
| 138 | hideFindMode({ exitEventIsEnter, exitEventIsEscape }) { |
| 139 | let postExit; |
| 140 | this.findMode.checkReturnToViewPort(); |
| 141 | |
| 142 | // An element won't receive a focus event if the search landed on it while we were in the HUD |
| 143 | // iframe. To end up with the correct modes active, we create a focus/blur event manually after |
| 144 | // refocusing this window. |
| 145 | globalThis.focus(); |
| 146 | |
| 147 | const focusNode = DomUtils.getSelectionFocusElement(); |
| 148 | if (document.activeElement != null) { |
| 149 | document.activeElement.blur(); |
| 150 | } |
| 151 | |
| 152 | if (focusNode && focusNode.focus) { |
| 153 | focusNode.focus(); |
| 154 | } |
| 155 | |
| 156 | if (exitEventIsEnter) { |
| 157 | FindMode.handleEnter(); |
| 158 | if (FindMode.query.hasResults) { |
| 159 | postExit = () => newPostFindMode(); |
| 160 | } |
| 161 | } else if (exitEventIsEscape) { |
| 162 | // We don't want FindMode to handle the click events that FindMode.handleEscape can generate, |
| 163 | // so we wait until the mode is closed before running it. |
| 164 | postExit = FindMode.handleEscape; |
| 165 | } |
| 166 | |
| 167 | this.findMode.exit(); |
| 168 | if (postExit) { |
| 169 | postExit(); |
| 170 | } |
| 171 | }, |
| 172 | |
| 173 | // These commands manage copying and pasting from the clipboard in the HUD frame. |
| 174 | // NOTE(mrmr1993): We need this to copy and paste on Firefox: |
nothing calls this directly
no test coverage detected