-
Notifications
You must be signed in to change notification settings - Fork 47.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Events from an <input> in the <legend> of a disabled <fieldset> get supressed #17909
Comments
I've checked that on:
It looks like described bug only appears on Firefox. In addition when you uncheck checkbox on Edge 18 it becomes disabled and you cannot change its state again. |
I don't know enough about this part of React DOM to say whether it's something that React DOM should smooth over or just a browser bug. (Have you tried to see if this behavior can be reproduced in Firefox without React?) |
Here I've created example that use pure Javascript and it works. As @MatthijsMud said - after second click on checkbox it doesn't execute onChange method and consequence of this is that enabled stays false so fieldset is always set to false after first checkbox click. |
Seems like a bug then. Help yourself if you'd be interested in digging in, @ideffix 😄 I've added the "good first issue (taken)" label so that others will know not to start work on the issue. If you change your mind about the issue, no worries! Just let me know so that I can remove the label and free it up for someone else to claim. Cheers! |
I've done some digging and I ended up in EventListener.js and addEventBubbleListener function. It adds for document click event listener. However when HTML element(fieldset, input) is disabled it doesn't fire click event on Firefox. Please check this example both in Chrome and Firefox here. So it looks like Firefox bug/feature 😄 |
Nice follow up work, @ideffix! Seems like maybe we should close this issue then and file one over on https://bugzilla.mozilla.org ? Looks like this one is related, so maybe you could just add the info above to it? |
Yes sure - I think we can close this :) |
Thanks for the investigation then! 🙇 |
The closest related issue I could, is somewhat of the inverse of this one: #7711
React version: 16.12 (older versions as well)
Steps To Reproduce
<fieldset>
with: a<legend>
containing an<input>
(checkbox) element, and another form element (<select>
,<input>
,<textarea>
).disabled
attribute that follows the aforementioned state to the<fieldset>
.onChange
event of the<input>
in the<fieldset>
responsible for modifying the state of the component (enabled/disabled).<fieldset>
using the<input>
in its<legend>
.<fieldset>
.Link to code example: Sandbox
The current behavior
Enabling the
<fieldset>
using the<input>
in its<legend>
changes the state of the<input>
in unchecked fashion; it does not fire itsonChange
event and its value does thus no longer match the state of the component.The expected behavior
Based on the W3C and WHATWG spec, the contents of the first
<legend>
of a<fieldset>
should not be disabled when that fieldset is disabled.One would expect that if an element does not appear disabled, its events will be triggered.
The text was updated successfully, but these errors were encountered: