Page MenuHomePhabricator

OO.ui.TextInputWidget.focus() doesn't work
Closed, InvalidPublic

Description

Minimal case below:

x = new OO.ui.TextInputWidget();
$('#bodyContent').prepend(x.$element);
x.focus();  // doesn't work
x.$element.focus();  // doesn't work

Expected: the text input should get focus and be ready to accept text input
Actual: nothing happens

Either I'm doing this wrong, or it's a bug. Tested on Firefox, Chrome, and Opera.

Event Timeline

bmansurov updated the task description. (Show Details)

@Volker_E thanks for the quick reply. x.$input.focus() doesn't work either.

x.focus() works for me. Note that if you run this from the browser console, you won't see the effect, because the console window has the focus rather than the website window. Try putting this code in a click handler or something for testing.