Input element looses focus when it is moved in the DOM




6 years ago
3 years ago


(Reporter: misko, Unassigned)


11 Branch
Mac OS X

Firefox Tracking Flags

(Not tracked)




6 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.165 Safari/535.19

Steps to reproduce:

1) create an input element
2) focus cursor on the input element
3) start typing -> keydown causes JS to move the input element in DOM tree
4) the input element no longer has focus

1) Change 'Adam' to 'xAdam' this will resort the list and place the input element on the end.
2) The moved element is still the same instance, but it no longer has focus, which means further key presses are no longer accepted
3) an unrelated input element has now focus. 

Actual results:

input element lost focus

Expected results:

The input element should still have focus even after DOM move.
short update:

I can reproduce the difference between Firefox and other browsers.

firefox: loose focus and give it to no other object.
G-chrome: focus on same object, but after next change of position also lose the focus.
IE11: focus on same object, but input blocked for changes.
Ever confirmed: true

Comment 2

3 years ago
User Agent 	Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:46.0) Gecko/20100101 Firefox/46.0
Build ID 	20160114060719

Can confirm the behavior described by Stefan on comment 1 for Firefox 43 / Nightly 46 and Chrome.
Component: Untriaged → Layout: Form Controls
Product: Firefox → Core
You need to log in before you can comment on or make changes to this bug.