Fixed: (UI) Use event.composedPath()

This commit is contained in:
Bogdan
2023-03-12 18:23:24 +02:00
parent f90d66376e
commit 88329ff104

View File

@@ -84,6 +84,10 @@ class SearchIndex extends Component {
} }
} }
componentWillUnmount() {
window.removeEventListener('keyup', this.onKeyUp);
}
// //
// Control // Control
@@ -192,7 +196,8 @@ class SearchIndex extends Component {
onKeyUp = (event) => { onKeyUp = (event) => {
const jumpBarItems = this.state.jumpBarItems.order; const jumpBarItems = this.state.jumpBarItems.order;
if (event.path.length === 4) {
if (event.composedPath && event.composedPath().length === 4) {
if (event.keyCode === keyCodes.HOME && event.ctrlKey) { if (event.keyCode === keyCodes.HOME && event.ctrlKey) {
this.setState({ jumpToCharacter: jumpBarItems[0] }); this.setState({ jumpToCharacter: jumpBarItems[0] });
} }