Opened 5 years ago

Last modified 3 years ago

#18388 new defect

shift detection on Button click event is broken in 1.10.2

Reported by: gstowe Owned by:
Priority: undecided Milestone: 1.15
Component: Dijit - Form Version: 1.10.2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

This appears to have been introduced by the following checkin:

https://github.com/dojo/dijit/commit/67444dbee8322fdf9a21f901b5b3c72fd0d908dc

User Rick Lacy on the community forum writes:

In _ButtonMixin.js there is an internal __onClick method. When this gets a hold of the click event, it tries to call the click method on some hidden value dom node. The trouble is, I don't think passing e to this click method does anything. The real event is clobbered and by the time your code executes, it's this new event.

Workaround:

 __onClick: function(/*Event*/ e){ 
                        /* summary: 
                        	Internal function to divert the real click onto the hidden INPUT that has a native default action associated with it 
                            type: 
                        	private 
                         */
                        e.stopPropagation(); 
                        e.preventDefault(); 

                        if(!this.disabled){ 
                                /* cannot use on.emit since button default actions won't occur 
                                this.valueNode.click(e); Try to skip this since clobbering items on event.  Does click() on dom node even take an event? */
                                this._onClick(e); 
                        } 
                        return false; 
                },

Change History (5)

comment:1 Changed 5 years ago by gstowe

(I'm not sure when this stopped working. I jumped from 1.7.2, when it worked, to 1.10.2 where it does not. Same code, just changed out the dojo versions. A click handler on a Button, executed with the shift key down shows shiftKey=true in 1.7.2 and shiftKey=false in 1.10.2.)

comment:2 Changed 5 years ago by bill

Description: modified (diff)

As that check-in comment implies, the idea is to have form submission etc. work correctly, for a normal non-shift click of a button in a form.

If the user does a shift-click on a button, I'm not sure what's supposed to happen. Is that supposed to submit the form (if the button is type=submit and inside a form)? If not, we could just call _onClick(e) in that case.

comment:3 Changed 4 years ago by dylan

Milestone: tbd1.11

Marking as 1.11, but we may push to 1.12.

comment:4 Changed 4 years ago by dylan

Milestone: 1.111.12

comment:5 Changed 3 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.