Opened 6 years ago

Closed 6 years ago

#16978 closed defect (fixed)

[regression] TextBox: can't focus widget with placeHolder on iOS

Reported by: bill Owned by: bill
Priority: undecided Milestone: 1.9
Component: Dijit Version: 1.9.0a1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

Noticed on test_validate.html on my iPad that clicking the textbox labeled "TextBox with placeholder" doesn't focus the textbox or open the keyboard. It works on Chrome/mac.

I'll look at this initially since it started w/my [31012] check in.

Change History (4)

comment:1 Changed 6 years ago by bill

Description: modified (diff)
Milestone: tbd1.9
Status: newassigned
Summary: TextBox: can't focus widget with placeHolder on iOS[regression] TextBox: can't focus widget with placeHolder on iOS

comment:2 Changed 6 years ago by bill

Version: 1.8.31.9.0a1

comment:3 Changed 6 years ago by bill

Since the click event occurs on the placeHolder <span> rather than the <input>, we need to programmatically focus to <input>.

On touch, iOS fires both touchdown/touchup and mousedown/mouseup. Previously the mousedown event triggered the call to _onFocus(), and then _FormWidgetMixin._onFocus() called focus() on the <input>, which was apparently working.

Now, touchstart triggers the call to _onFocus(), and then on touchend, _FormWidgetMixin._onFocus() calls this.defer("focus") (see [30663]), which seems to have no effect. No affect if I delay the focus call until after the mousedown comes in either. I can get it to work though by *not* delaying the focus() call.

iOS is known to intentionally ignore focus() calls (or at least, to not popup the keyboard just because focus is changed programatically), so all this code seems fragile. In the long term it would be better to use the native placeHolder when available. Unfortunately IIUC it's not available on IE9, let alone older versions of IE.

comment:4 Changed 6 years ago by bill

Resolution: fixed
Status: assignedclosed

Fixed in [31192], but I wrote the wrong version number. On touchend on the placeholder, focus immediately, rather than delayed by a this.defer(), so that the keyboard pops up.

Note: See TracTickets for help on using tickets.