Opened 13 years ago

Closed 12 years ago

#8595 closed defect (fixed)

_onFocus() fires on disabled widgets

Reported by: bill Owned by: bill
Priority: high Milestone: 1.5
Component: Dijit Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:


As noted in [16433], clicking on a disabled widget causes _onFocus() to be fired. This doesn't seem right.

Note that the reason clicking causes _onFocus() to fire at all is so clicking the up/down buttons for a Spinner (or the open button for a ComboBox's drop down) will note that said widget is active, even though it didn't cause an actual focus event.

Change History (5)

comment:1 Changed 12 years ago by bill

See also #8903, #8923, likely manifestations of this problem.

comment:2 Changed 12 years ago by bill

Milestone: 1.51.6

comment:3 Changed 12 years ago by bill

Status: newassigned

Changed my mind, will fix this for 1.5.

comment:4 Changed 12 years ago by bill

Milestone: 1.61.5

comment:5 Changed 12 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [22011]) Fixes so that disabled widgets don't get focus by mouse or keyboard:

  • Made focus manager ignore click events on disabled widgets. It still responds to actual focus events so that Menu still works (which focuses the disabled MenuItems). Clicking a disabled dijit.form.Button in an enabled TabContainer will call onFocus() on the TabContainer (and the ContentPane) but not the Button.
  • Fixed _FormWidget._setDisabledAttr() to set/remove tabIndex on all focusable nodes. Usually only focusNode is focusable, but ComboButton has two focusable nodes. Disabling a widget now sets tabIndex=-1 on nodes like <button> but removes tabIndex on nodes like <div>.
  • Added new method dijit.hasDefaultTabStop() to support above code.

The only remaining problem is webkit, where clicking widgets still gives them focus, but this is a webkit bug that doesn't seem feasible to workaround. I did add workaround code for webkit so at least keyboard works correctly, by using tabIndex=-1 instead of removing tabIndex (see #11064 for details).

Fixes #8903, #8923, #8595, #11053, refs #11064 !strict.

Note: See TracTickets for help on using tickets.