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