-
-
Notifications
You must be signed in to change notification settings - Fork 261
Consider supporting custom elements #1212
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
Comments
I think this is fine. Not sure we need a manual opt-in (it doesn't seem breaking change to me, since you couldn't have used custom elements before). |
I just ran into this issues as well using Shoelace web components. I converted a native In this case, the custom element is not built with a Has there been more thought/discussion around @mmun's proposed options? |
The API of Shoelace's select doesn't use |
Uh oh!
There was an error while loading. Please reload this page.
I have a custom element
my-text-input
whose important properties and events mirror that of an<input type="text">
, e.g. It has avalue
property and dispatchesinput
andchange
events.Many of the existing test helpers have checks that prevent them from being used on custom elements because they call these methods in order to provide helpful error messages when an unexpected element occurs.
ember-test-helpers/addon-test-support/@ember/test-helpers/dom/-is-form-control.ts
Lines 16 to 25 in d17d27c
ember-test-helpers/addon-test-support/@ember/test-helpers/dom/-is-select-element.ts
Lines 8 to 12 in d17d27c
I'm wondering if there is a way to weaken these checks so that custom elements can be used. I'm leaning towards allowing custom elements (i.e. elements with a hyphen in the tag name) to bypass the checks. Maybe behind a flag.
You might wonder: is
my-text-input
built with an<input>
under the hood? Can we simply target that directly? In my case, the underlying implementation is indeed a native<input>
but it is inside shadow DOM which makes it tedious to access in tests e.g.fillIn(find('my-text-input').shadowRoot.querySelector('input'), 'new text')
. More importantly, it should really be treated as an implementation detail that is not leaked to consumers.The alternative to implementing this suggestion is to have the design system ship its own mirror of the ember test helpers that are coupled to the internals of each custom element and know to delegate to the appropriate underlying inputs.
The text was updated successfully, but these errors were encountered: