Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#7978 closed defect (wontfix)

Button: clicking on border of button causes event to fire with incorrect target

Reported by: Paul Barrass Owned by:
Priority: high Milestone: tbd
Component: Dijit - Form Version: 1.2.0
Keywords: Cc: paul.barrass@…
Blocked By: Blocking:

Description

If a dojo button is clicked near/at it's edge, the event that is fired has a target/currentTarget of the <span>s surrounding the button, rather than the button itself, leading to problems determining which button was clicked. A workaround appears to be to test for this mis-targeted event and get the firstChild of the target.

This behaviour was not present in 1.1.1 - clicking on any part of the button resulted in an event with the button as the target.

Tested in FireFox? 3.0 and IE7

Paul Barrass

Change History (3)

comment:1 Changed 11 years ago by bill

Component: GeneralDijit
Owner: anonymous deleted

I'm assuming you mean "dijit button"? There's no such thing as a "dojo button" per se. Can you give a testcase?

This sounds like #6880.

comment:2 Changed 11 years ago by bill

Resolution: wontfix
Status: newclosed
Summary: Clicking on border of button causes event to fire with incorrect targetButton: clicking on border of button causes event to fire with incorrect target

If you just setup a separate onClick handler for each Button that will work

<button dojotype="dijit.form.Button" onClick="alert('button 1');">button 1</button>

If you want one handler function for multiple button clicks then you can reference "this":

<script>
function myOnclick(){
  alert(this.id);
}
</script>
...
<button dojotype="dijit.form.Button" onClick="myOnclick">button 1</button>

Basically, I don't see a good reason to even reference that event parameter.

comment:3 Changed 9 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.