Fix livestream key listeners (#702)
This commit is contained in:
parent
ea9c7a4a27
commit
a1a7ca321f
1 changed files with 5 additions and 2 deletions
|
@ -241,6 +241,7 @@ export default function TextareaWithSuggestions(props: Props) {
|
||||||
isEmote,
|
isEmote,
|
||||||
});
|
});
|
||||||
} else if (suggestionValue) {
|
} else if (suggestionValue) {
|
||||||
|
inputRef.current.removeAttribute('typing-term');
|
||||||
setSuggestionValue(null);
|
setSuggestionValue(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,12 +324,14 @@ export default function TextareaWithSuggestions(props: Props) {
|
||||||
return () => window.removeEventListener('keydown', handleKeyDown);
|
return () => window.removeEventListener('keydown', handleKeyDown);
|
||||||
}, [handleSelect, highlightedSuggestion, suggestionTerm]);
|
}, [handleSelect, highlightedSuggestion, suggestionTerm]);
|
||||||
|
|
||||||
// Prevent keyboard keys like Up and Down being overriden by MUI listeners when not in use
|
// Prevent keyboard keys Up and Down being overriden by MUI listeners when not in use
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const inputElement = inputRef && inputRef.current;
|
const inputElement = inputRef && inputRef.current;
|
||||||
|
|
||||||
function overrideKeyHandling(event) {
|
function overrideKeyHandling(event) {
|
||||||
if (!suggestionTerm) {
|
const { keyCode } = event;
|
||||||
|
|
||||||
|
if (!suggestionTerm && (keyCode === KEYCODES.UP || keyCode === KEYCODES.DOWN)) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue