0

I need to detect when the popup key for selection is out on the textarea:

enter image description here

This one in the picture to be clear.

My current finding is that registering events as i did in the fiddle down does not help me finding something unique when the popup opens.

Why i need to detect the popup? Because i have some event registered on the keydown that call a e.preventDefault() and e.stopImmediatePropagation(). On firefox for example this kind of event handling stop the popup from working completely and so i need to disable my even handler when the popup is opened.

var txt = document.getElementById('test');

txt.addEventListener('compositionupdate', console.log);
txt.addEventListener('compositionstart', console.log);
txt.addEventListener('compositionend', console.log);
txt.addEventListener('input', console.log);
txt.addEventListener('keyup', console.log);
txt.addEventListener('keydown', console.log);
txt.addEventListener('keypress', console.log);
<textarea id="test" ></textarea>
AndreaBogazzi
  • 14,323
  • 3
  • 38
  • 63

1 Answers1

0

Some months later, i realized how to handle it.

This was mainly to detect the use of this popup in fabricjs. I stop playing with keyup and keydown and i delegated everything to the oninput event. Now when any oninput events fires, i compare what i have in the textarea with my text var, plus i check the position of the cursor before and after and i detect the changes.

It works pretty good, but not, the popup is not detectable.

AndreaBogazzi
  • 14,323
  • 3
  • 38
  • 63