-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Custom elements not able to associate with form #10948
Comments
+1. I have also searched high and low for the very same thing you are describing. It seems like a big limitation in defineCustomElement to not being able to pass arguments to the underlying CustomElement constructor. In this case attachInternals & static formAssociated properties. Did you find any solution to your problem? Sidenote: |
The only way to bypass this is to set a hidden input with the right name and value thru js but it kinda defeats the purpose of creating a custom element in my opinion. |
I think we could have a static formAssociated = !!Comp.formAssociated
constructor(initialProps?: Record<string, any>) {
super(Comp, initialProps, hydrate);
if (this.attachInternals) this._internals = this.attachInternals();
} Then, users can utilize For temp solution, check out this, I made some changes based on your demo |
Vue version
3.4.27
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-ikoo1s?file=src%2Fcomponents%2Fui%2Ftime-picker%2FTimePicker.ce.vue
Steps to reproduce
Choose time and submit form
What is expected?
To have the custom element as a form-associated custom element
What is actually happening?
The element is not taken as part of the form when submitted
System Info
Any additional comments?
I've looked high and low, tried attachInternals() but on the button and a template ref doesn't work either, I'd like to have a way to associate the custom element as a form-associated custom element which we can do in vanilla js. But it's during the creation of the HTMLElement class that you can set it but we cannot modify this with the new defineCustomElement method.
The text was updated successfully, but these errors were encountered: