Open Bug 1220817 Opened 5 years ago Updated 5 years ago

If setSelectionRange is called on a textarea with display:none, an NS_ERROR_FAILURE is thrown


(Core :: DOM: Selection, defect)

43 Branch
Not set





(Reporter: corywgorman, Unassigned)


User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36

Steps to reproduce:

See this jsbin:,css,js,output

There is both an input and a textarea on the page, and both are hidden with display:none. Pressing the corresponding button attempts to use setSelectionRange() and focus() on that element.

Actual results:

Pressing the button for the input seems to do nothing (and the body keeps focus), while pressing the button for the textarea throws an error: NS_ERROR_FAILURE, which seems to be a generic error.

Expected results:

Both the input and the textarea should behave the same way, and no error should be thrown. In Chrome, the buttons receive focus, which is different than the body receiving focus; however, I'm not sure which is correct.

Happens in both developer edition (43) and ESR (38).
Component: Untriaged → Selection
Product: Firefox → Core
You need to log in before you can comment on or make changes to this bug.