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

On Thu, May 7, 2015 at 12:21 PM, Ramya Vadlamudi <ramya.v@samsung.com> wrote:
> 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.

Actually, it only says the former (since only those end up on the user
interaction task source). It makes no claims about what should happen
for other events.

> 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.

It does not bypass, it's just a different requirement.


> 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

No, spec1 does not apply here.


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

Spec1 does not apply here and neither does spec2. So yes, this should
be dispatched, since there's no evidence to the contrary.


> Attached sample test file for you reference.

You might want to upload that somewhere. It did not get through at
least for me. Your browser results were also mangled in a text/plain
view of your email (which is the only one I got).


-- 
https://annevankesteren.nl/

Received on Friday, 8 May 2015 07:01:04 UTC