[RM] Bug Fix ctrl + f and f3 handling in Search input.
@@ -63,14 +63,24 @@ class SearchInputBase extends React.PureComponent<Props, State> {
}
componentDidMount() {
- // we need to use 'top' in case of working in iframe
+ // we need to subscribe to events in both top window's document and inner iframe document events,
+ // because in some cases (e.g. user pressed tab key) browser focuses on iframe and events from top.document doesn't trigger
+ if (top.document !== document) {
top.document.addEventListener("keydown", this.documentOnKeyDown);
}
+ document.addEventListener("keydown", this.documentOnKeyDown);
+ }
+
componentWillUnmount() {
+ // same as subscribing in componentDidMount
+ if (top.document !== document) {
top.document.removeEventListener("keydown", this.documentOnKeyDown);
}
+ document.removeEventListener("keydown", this.documentOnKeyDown);
+ }
+
componentDidUpdate(prevProps: Props) {
if (this.props.searchString !== prevProps.searchString) {
// search string and search results updated, so we need to stop loader
