do not close dialog when editable element in focus

This commit is contained in:
Ajay Bura 2024-12-21 18:26:57 +05:30
parent a91acbd672
commit 6b1d827f2b

View file

@ -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;
};