Opened 7 years ago
Closed 6 years ago
#17796 closed defect (fixed)
Button: strips key information from click events
Reported by: | cwgorman | Owned by: | Patrick Ruzand |
---|---|---|---|
Priority: | undecided | Milestone: | 2.0 |
Component: | Dijit - Form | Version: | 1.9.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
When attaching a click
handler to a dijit Button, the event object properties shiftKey
, altKey
, and ctrlKey
are always false, regardless of whether the keys were actually pressed when the click occurred.
Here is a JSFiddle demonstrating the behavior: http://jsfiddle.net/y7JBm/2/
Hold Shift, Ctrl, or Alt and click either button. Note that the values returned are always false. For comparison, you can click on the div
and see that the key information is correct.
Also, if one was to tab to the Button, hold Shift, and then press 'Enter', I would expect the resulting click
event to have shiftKey=true despite not being a 'real' click.
Change History (2)
comment:1 Changed 7 years ago by
Milestone: | tbd → 2.0 |
---|---|
Owner: | set to Patrick Ruzand |
Status: | new → assigned |
Summary: | Button: dijit.form.Button strips key information from Click events → Button: strips key information from click events |
comment:2 Changed 6 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
OK, so it's fixed in https://github.com/ibm-js/deliteful, so closing this ticket.
Although you would think this was trivial to fix, the problem is actually intrinsic to how Button is implemented with plain <div>/<span> DOMNodes and contains a hidden <input>. I'm talking about the code in _ButtonMixin that refires the click event:
We are passing the event object to
this.valueNode.click()
, but in reality that method doesn't take any parameters. Thus AFAICT there's no way to set shift/ctrl etc.So anyway, this will be fixed in 2.0 when the Button widget is actually implemented as a <button>. I can't think of anyway to fix it beforehand.