Opened 9 years ago

Closed 8 years ago

#12712 closed defect (fixed)

dijit.form.ToggleButton doesn't toggle if checked is changed during onClick

Reported by: ben hockey Owned by: Douglas Hays
Priority: high Milestone: 1.7
Component: Dijit - Form Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

if checked is changed during the onClick for a dijit.form.ToggleButton? then the toggle may not work. see attached test case and attached patch.

this defect is seen in trunk (1.7 development).

Attachments (2)

12712.html (695 bytes) - added by ben hockey 9 years ago.
12712.diff (547 bytes) - added by ben hockey 9 years ago.

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by ben hockey

Attachment: 12712.html added

Changed 9 years ago by ben hockey

Attachment: 12712.diff added

comment:1 Changed 8 years ago by ben hockey

Summary: [patch][cla] dijit.form.ToggleButton doesn't toggle if checked is changed during onClick[regression][patch][cla] dijit.form.ToggleButton doesn't toggle if checked is changed during onClick

comment:2 Changed 8 years ago by Douglas Hays

Milestone: tbd1.7
Summary: [regression][patch][cla] dijit.form.ToggleButton doesn't toggle if checked is changed during onClick[patch][cla] dijit.form.ToggleButton doesn't toggle if checked is changed during onClick
Version: 1.6.01.6.1

Using HTML's checkbox as the rubric, both 1.6 and 1.7 have it wrong<br>

before click: checked=true,  onclick handler: return false, after click: checked=true
before click: checked=true,  onclick handler: return true,  after click: checked=false
before click: checked=true,  onclick handler: return false, after click: checked=true
before click: checked=true,  onclick handler: return true,  after click: checked=false
before click: checked=false, onclick handler: return false, after click: checked=false
before click: checked=false, onclick handler: return true,  after click: checked=true
before click: checked=false, onclick handler: return false, after click: checked=false
before click: checked=false, onclick handler: return true,  after click: checked=true
before click: checked=true,  onclick handler: no return, after click: checked=false
before click: checked=true,  onclick handler: no return,  after click: checked=false
before click: checked=true,  onclick handler: no return, after click: checked=false
before click: checked=true,  onclick handler: no return,  after click: checked=false
before click: checked=false, onclick handler: no return, after click: checked=true
before click: checked=false, onclick handler: no return,  after click: checked=true
before click: checked=false, onclick handler: no return, after click: checked=true
before click: checked=false, onclick handler: no return,  after click: checked=true
before click: checked=true,  onclick handler: checked=false and return false, after click: checked=true
before click: checked=true,  onclick handler: checked=false and return true,  after click: checked=false
before click: checked=true,  onclick handler: checked=true  and return false, after click: checked=true
before click: checked=true,  onclick handler: checked=true  and return true,  after click: checked=true
before click: checked=false, onclick handler: checked=false and return false, after click: checked=false
before click: checked=false, onclick handler: checked=false and return true,  after click: checked=false
before click: checked=false, onclick handler: checked=true  and return false, after click: checked=false
before click: checked=false, onclick handler: checked=true  and return true,  after click: checked=true
before click: checked=true,  onclick handler: checked=false and no return, after click: checked=false
before click: checked=true,  onclick handler: checked=false and no return,  after click: checked=false
before click: checked=true,  onclick handler: checked=true  and no return, after click: checked=true
before click: checked=true,  onclick handler: checked=true  and no return,  after click: checked=true
before click: checked=false, onclick handler: checked=false and no return, after click: checked=false
before click: checked=false, onclick handler: checked=false and no return,  after click: checked=false
before click: checked=false, onclick handler: checked=true  and no return, after click: checked=true
before click: checked=false, onclick handler: checked=true  and no return,  after click: checked=true

Implied algorithm for handling the onclick event:
return true means to use the handler's value if specified, or the toggled current value if not specified
return false means to leave the current value even if changed in the onclick handler
no return value is the same as true 

comment:3 Changed 8 years ago by Douglas Hays

Summary: [patch][cla] dijit.form.ToggleButton doesn't toggle if checked is changed during onClickdijit.form.ToggleButton doesn't toggle if checked is changed during onClick

comment:4 Changed 8 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [24793]) Fixes #12712. Change _TogglebuttonMixin _onClick to reflect native checkbox behavior. Added automated tests. Changed mobile.parser to understand checked implied boolean in markup. !strict

Note: See TracTickets for help on using tickets.