[whatwg] Regarding spec clarification on dispatching click event on disabled form controls

Regarding the spec clarification,

 

As per spec1

https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled

A form control that is disabled must prevent any click events that are
queued on the user interaction task source from being dispatched on the
element.

 

Which means except for click events generated by user interaction through
mouse or keyboard, all other generated events should be dispatched to
disabled elements.

 

As per spec2

https://html.spec.whatwg.org/multipage/interaction.html#dom-click

The click() method must run the following steps:

If the element is a form control that is disabled, abort these steps.

 

which means even if DOM click is a generated event it should not be
dispatched to disabled elements, which looks to be bypassing first spec.

 

For ex: In javascript if button is a HTMLButtonElement

button.click();   -  As per spec2 event should not be dispatched, as per
spec1 event should be dispatched

button.dispatchEvent(new Event('click'));  - As per spec1 event should be
dispatched.

 

Results in various browsers

 

 


Function

IE

Firefox

Chrome


button.click()

Event not dispatched

Event not dispatched

Event not dispatched


button.dispatchEvent(new Event('click'));

Event not dispatched

Event not dispatched

Event dispatched

 

 

Can you please clarify what is supposed to be the correct behavior.

Attached sample test file for you reference.

 

Thanks & Regards,

Ramya

Received on Thursday, 7 May 2015 10:20:08 UTC