Skip to content

Commit

Permalink
fix: collision between shortcuts and emoji-picker webcomponent
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfran committed Feb 20, 2025
1 parent 633198b commit d0ddcb8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions libs/cdk/src/lib/utils/is-input-field.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
export function getActitveElement() {
if (document.activeElement?.shadowRoot) {
return document.activeElement.shadowRoot.activeElement;
}

return document.activeElement;
}

export function isInputField() {
const activeElement = getActitveElement();

return (
document.activeElement?.hasAttribute('contenteditable') ||
document.activeElement?.tagName === 'INPUT' ||
document.activeElement?.tagName === 'TEXTAREA'
activeElement?.hasAttribute('contenteditable') ||
activeElement?.tagName === 'INPUT' ||
activeElement?.tagName === 'TEXTAREA'
);
}

0 comments on commit d0ddcb8

Please sign in to comment.