mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-23 13:43:07 +01:00
do not close dialog when editable element in focus
This commit is contained in:
parent
a91acbd672
commit
6b1d827f2b
1 changed files with 9 additions and 0 deletions
|
@ -34,6 +34,15 @@ export const onEnterOrSpace =
|
||||||
};
|
};
|
||||||
|
|
||||||
export const stopPropagation = (evt: KeyboardEvent): boolean => {
|
export const stopPropagation = (evt: KeyboardEvent): boolean => {
|
||||||
|
const ae = document.activeElement;
|
||||||
|
const editableActiveElement = ae
|
||||||
|
? ae.nodeName.toLowerCase() === 'input' ||
|
||||||
|
ae.nodeName.toLowerCase() === 'textarea' ||
|
||||||
|
ae.getAttribute('contenteditable') === 'true'
|
||||||
|
: false;
|
||||||
|
|
||||||
|
if (editableActiveElement) return false;
|
||||||
|
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue