-
Notifications
You must be signed in to change notification settings - Fork 295
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
Lion Button should not react to clicks when its disabled #2354
base: master
Are you sure you want to change the base?
Lion Button should not react to clicks when its disabled #2354
Conversation
|
From this MDN article I got to the official HTML spec, and after navigating for a while I got to form-associated custom elements:
Or, in a nutshell, from my understanding of those paragraphs: the I'd suggest you to please check all lion input fields and see if they all are form-associated. For your convenience (and your sanity), there is a list of form-associated elements |
Thanks @denilsonsa really useful links 👍 . So I learned that I'm currently blocked by this MR: #2353 because without it, I can't get these components under automated tests. |
Thanks for discovering the bug in LionButton and all the investigative work @aghArdeshir and @denilsonsa! Wrt adding So the best way to fix this is disabling . click() {
if (this.disabled) return;
super.click();
} That doesn't mean we don't want form association in Lion. Together with ElementInternals, it is indeed something that we want to be incorporate in our form controls in the future, especially as they might allow us to get rid of the registration system and they will make our code base leaner/smaller in general. |
@aghArdeshir do you want to create a pull request for this?
|
This PR fixes: #2330 and is blocked by: #2353
This PR:
disabled
and click is trigger programatically using JS.click()
method #2330 in automated tests.static formAssociated = true
to the LionButton which fixes the problem at hand. I don't know what is this and why it fixes the issue, but it works in both the automated test and in my manual tests. (and does not break any other test, so I assume it should be good). I first read about it here: https://webkit.org/blog/13711/elementinternals-and-form-associated-custom-elements/, and then I found some references to it in the@webcomponents/scoped-custom-element-registry
fromnode_modules
.If I found any more information about the
formAssociated
, I'll share. If anyone knows what is this and why it fixes the issue, please knowledge-share 🙏