fix: Keyboard handlers should not be considered while composing
This commit is contained in:
@@ -20,6 +20,10 @@ function ArrowKeyNavigation(
|
||||
const handleKeyDown = React.useCallback(
|
||||
(ev) => {
|
||||
if (onEscape) {
|
||||
if (ev.nativeEvent.isComposing) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.key === "Escape") {
|
||||
onEscape(ev);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ function InputSearchPage({
|
||||
|
||||
const handleKeyDown = React.useCallback(
|
||||
(ev: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (ev.nativeEvent.isComposing) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.key === "Enter") {
|
||||
ev.preventDefault();
|
||||
history.push(
|
||||
|
||||
@@ -88,10 +88,14 @@ function SearchPopover({ shareId }: Props) {
|
||||
|
||||
const handleSearchInputFocus = React.useCallback(() => {
|
||||
focusRef.current = searchInputRef.current;
|
||||
}, []);
|
||||
}, [searchInputRef]);
|
||||
|
||||
const handleKeyDown = React.useCallback(
|
||||
(ev: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
if (ev.nativeEvent.isComposing) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.key === "Enter") {
|
||||
if (searchResults) {
|
||||
popover.show();
|
||||
|
||||
@@ -260,6 +260,9 @@ function SuggestionsMenu<T extends MenuItem>(props: Props<T>) {
|
||||
const handleLinkInputKeydown = (
|
||||
event: React.KeyboardEvent<HTMLInputElement>
|
||||
) => {
|
||||
if (event.nativeEvent.isComposing) {
|
||||
return;
|
||||
}
|
||||
if (!props.isActive) {
|
||||
return;
|
||||
}
|
||||
@@ -441,6 +444,9 @@ function SuggestionsMenu<T extends MenuItem>(props: Props<T>) {
|
||||
};
|
||||
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.isComposing) {
|
||||
return;
|
||||
}
|
||||
if (!props.isActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user