mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
This commit is contained in:
parent
25640e42ff
commit
af877f7ddb
5
.changeset/poor-years-help.md
Normal file
5
.changeset/poor-years-help.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@nextui-org/autocomplete": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix #1909 overwrite `onKeyDown` to prevent meaningless error msg
|
||||||
@ -301,6 +301,21 @@ export function useAutocomplete<T extends object>(originalProps: UseAutocomplete
|
|||||||
state,
|
state,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// to prevent the error message:
|
||||||
|
// stopPropagation is now the default behavior for events in React Spectrum.
|
||||||
|
// You can use continuePropagation() to revert this behavior.
|
||||||
|
if (inputProps.onKeyDown) {
|
||||||
|
const originalOnKeyDown = inputProps.onKeyDown;
|
||||||
|
|
||||||
|
inputProps.onKeyDown = (e) => {
|
||||||
|
if ("continuePropagation" in e) {
|
||||||
|
e.stopPropagation = () => {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return originalOnKeyDown(e);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const Component = as || "div";
|
const Component = as || "div";
|
||||||
|
|
||||||
const slots = useMemo(
|
const slots = useMemo(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user