mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-13 17:10:06 +00:00
do not close dialog when editable element in focus
This commit is contained in:
parent
a91acbd672
commit
6b1d827f2b
|
@ -34,6 +34,15 @@ export const onEnterOrSpace =
|
|||
};
|
||||
|
||||
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();
|
||||
return true;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue