In my extension I’d like to distinguish events having been triggered in elements that are editable by the user from those triggered elsewhere. The test should also include read-onlyness of elements, even if it is only declared by, e.g., ARIA attributes.
So far I came up with the following criterion (t
being the event target)
editable =
((t.isContentEditable) ||
(t === document.activeElement)) &&
(! ((t.getAttribute( "readonly" )?.toLowerCase() === "true") ||
(t.ariaReadOnly) ||
(t.getAttribute( "aria-readonly" )?.toLowerCase() === "true")))
Does that look OK? Anything else to consider?
Thanks!