It appears that there may be a bug causing this issue (thank you for reporting it!). Typically, a click event is triggered on the deepest element that has observed both the mousedown
and mouseup
events. One way to disrupt the click event is by repositioning the textarea when it is in focus (for example, using position:absolute; top: xxx
). This is because the sequence of events is mousedown->focus (which updates the web page)->mouseup->click.
The resize
property governs "anonymous content" that is not visible to the web page but is utilized by the browser to provide additional UI features for the user's convenience. It is possible that modifications to this content are causing interference with the detection of the click
event>. However, without examining this situation in a debug build, it is difficult to ascertain the exact cause.
function logEvent(ev) {console.log(ev.type, window.getComputedStyle(document.querySelector("textarea")).resize)}
document.querySelector("textarea").addEventListener("mousedown", logEvent, false);
document.querySelector("textarea").addEventListener("focus", logEvent, false);
document.querySelector("textarea").addEventListener("mouseup", logEvent, false);
document.querySelector("textarea").addEventListener("click", logEvent, true);
textarea:focus{
position:absolute; top: 500px;
}
<textarea>click me</textarea>