caitp / angular-semantic

AngularJS directives for Semantic-UI
413 stars 47 forks source link

fix: removed 'if' breaking checkbox main functionality #14

Closed tmszdmsk closed 10 years ago

tmszdmsk commented 10 years ago

element you are actually clicking at isn't the input element

caitp commented 10 years ago

Hmm, there's a bit of an issue --- the problem is that it's possible to get the click event from both the label (within the template) and the click event.

If both events are received, then they essentially cancel each other out, so some kind of filtering is required. Unfortunately it's not an issue of bubbling, so it can't be prevented by cutting out bubbling.

It might be possible to work around it by using the "alternative template" using the box class (using pseudo-elements), pseudo-elements will probably solve the issue elegantly

tmszdmsk commented 10 years ago

I did test it by clicking in few 'weird' and possibly problematic places and I didn't notice any 'doubled click'. On the other hand, it didn't work at all with if I removed.

caitp commented 10 years ago

When wrapped in a label, for example,

  <label>label <input toggle ng-model="checked" /></label>

clicking on the outter label dispatches events to child nodes, regardless of whether or not bubbling is cancelled or not. I'm not quite sure of the work-around, but I don't think forbidding a style of markup is the way to go

caitp commented 10 years ago

I'll merge it for now, but I think another solution to the above needs to be found, and I haven't had much time to hack on this lately.

Closed by f100d00f720f3b45dc57dddfcea2cfec22ca6188