You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there is another <input> with autofocus-attribute on the page, trix will take away the focus from the field. I tracked this down to this method (added in 9c433d5)
which is called when initializing the editor. This only happens when the JS code is loaded using defer, and only on Chrome / Safari (thus probably Edge too). I found the following info on MDN:
Safari and Chrome (unlike Firefox) currently focus the element containing selection when modifying the selection programmatically; it's possible that this may change in the future (see W3C bug 14383 and Webkit bug 38696).
I think this may be the same issue as described in #1166.
(I was not able to reproduce this on codepen due to their iframe-structure, but it reproduces when hosted normally)
Note that the focus is not on the initial <input>-element (the outline is still rendered, but when typing in characters nothing happens). After focusing the element manually a hard-reload is necessary to reproduce the problem.
Removing defer or the <trix-editor>-element restores normal autofocus-behavior.
Details
Trix version: 2.1.5
Browser name and version: Latest Chrome & Safari - works on Firefox
Operating system: macOS
The text was updated successfully, but these errors were encountered:
When there is another
<input>
withautofocus
-attribute on the page, trix will take away the focus from the field. I tracked this down to this method (added in 9c433d5)trix/src/trix/models/selection_manager.js
Lines 92 to 94 in 457a834
which is called when initializing the editor. This only happens when the JS code is loaded using
defer
, and only on Chrome / Safari (thus probably Edge too). I found the following info on MDN:I think this may be the same issue as described in #1166.
Steps to Reproduce
(I was not able to reproduce this on codepen due to their iframe-structure, but it reproduces when hosted normally)
<input>
-element (the outline is still rendered, but when typing in characters nothing happens). After focusing the element manually a hard-reload is necessary to reproduce the problem.defer
or the<trix-editor>
-element restores normal autofocus-behavior.Details
The text was updated successfully, but these errors were encountered: