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 created this task.Jun 6 2019, 3:16 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 6 2019, 3:16 AM
bmansurov removed bmansurov as the assignee of this task.Jun 6 2019, 3:49 AM
bmansurov updated the task description. (Show Details)

@bmansurov You need x.$input.focus();

Volker_E closed this task as Invalid.Jun 6 2019, 3:54 AM
bmansurov added a comment.EditedJun 6 2019, 3:57 AM

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

bmansurov reopened this task as Open.Jun 6 2019, 4:15 AM

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.

bmansurov closed this task as Invalid.Jun 8 2019, 1:27 AM

@matmarex Thanks, that makes sense.