Open malworthy opened 1 month ago
I am also experiencing the issue with lost focus on enter key presses. It started occuring in v2.46.0
. Looking through the change logs I suspect this change set
Specifically e.preventDefault()
is changed to call event._enterPrevent(e)
and there is an _enterPrevent()
which triggers a focus event elsewhere: this.__focusTemp.focus();
Thanks for your efforts!
I think you're on to something there.
We've had a few people with laptops experience this, but most with laptops or desktops have no issue. Until I read this thread yesterday I couldn't reproduce it on my desktop.
This morning I learned how to set the user agent in Chrome, I chose iPad to make it appear mobile, and this trips the issue consistently. I've tested both in our application and at http://suneditor.com/sample/index.html
I'm not convinced it's the user agent necessarily, though. Perhaps something else in this:
this.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
EDIT: OK, now I'm sure it's the touch points test. It's being flagged as a mobile device on our laptops that support touch screen input.
OK, I've messed about with this to trip or prevent the issue:
I have no solution at this point other than locking the version of the library at 2.45.1.
The laptop I'm experiencing this issue on has a touchscreen - so touch points theory hold up.
same problem, but solved by locking to v2.45.1
Details After pressing the enter key, focus jumps to the top of the page.
To Reproduce Can be replicated in the options sample: http://suneditor.com/sample/html/options.html Click into the editor. Press enter key. Focus will go to the top of the screen.
Only happens in v2.46.3 of Suneditor, Issue not present in v2.45.1
Expected behaviour For focus to stay in the control after pressing the enter key