Financial-Times / ftdomdelegate

Create and manage a DOM event delegator
MIT License
320 stars 36 forks source link

Click events are fired on disabled button with element like i tag. #73

Closed ledsun closed 5 years ago

ledsun commented 9 years ago

I expect no click event is fired from a disabled button. But click events are fired when the button has a member element like i tag.

Sample

https://jsfiddle.net/63f4qpp8/1/

Why need

I want use button with font-awesome icons.

For examle:

<button><i class="fa fa-500px"></i></button>
orangemug commented 8 years ago

I believe I have a fix for this in https://github.com/ftlabs/ftdomdelegate/compare/master...orangemug:fix/issue-73-disabled-events however it needs a little more work to improve the performance

orangemug commented 8 years ago

I believe branch https://github.com/ftlabs/ftdomdelegate/compare/master...orangemug:fix/issue-73-disabled-events is now ready and fixes point 1 in the below spec extract

A form control is disabled if any of the following conditions are met:

  1. The element is a button, input, select, or textarea element, and the disabled attribute is specified on this element (regardless of its value).
  2. The element is a descendant of a fieldset element whose disabled attribute is specified, and is not a descendant of that fieldset element's first legend element child, if any.

See https://html.spec.whatwg.org/multipage/forms.html#enabling-and-disabling-form-controls:-the-disabled-attribute

Once the blocking PR #81 is merged I'll raise a PR for this ticket.

notlee commented 5 years ago

Hi all, this is fixed by orangemug's pr which will go out in the next release (v3.1.0). Thanks for creating the issue and waiting so long!