-
Notifications
You must be signed in to change notification settings - Fork 600
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] Using list
autocomplete
#5954
Comments
This is still very much an issue that affects downstream components. |
@radium-v any ideas or thoughts here? |
The key issue is that In the example below, <fast-text-field list="ice-cream-flavors"></fast-text-field>
<datalist id="ice-cream-flavors">
<option value="Chocolate">
<option value="Coconut">
<option value="Mint">
<option value="Strawberry">
<option value="Vanilla">
</datalist> |
This is also an issue with other web component libraries, such as PolymerElements/paper-input#595. @au5ton is correct that the issue lies with the platform and how it handles mapping ID'd elements between the light and shadow DOM. I also vaguely remember this being a common problem with accessibility features which rely on ID mapping, like One thing I tried locally was adding a slotted datalist, but even that doesn't get picked up by the text-field in any browser. We'd still have to resort to either copying an existing An alternative for today may be to use the <fast-combobox autocomplete="list">
<fast-option>Chocolate</fast-option>
<fast-option>Coconut</fast-option>
<fast-option>Mint</fast-option>
<fast-option>Strawberry</fast-option>
<fast-option>Vanilla</fast-option>
</fast-combobox> This may work best when you only have one element that needs the list; if you have multiple inputs that all pull from the same list, this would lead to a lot of duplication (but then again, so would copying the original list into each element's shadow dom). I feel it's worth noting that the native experience for datalist-bound inputs is subpar at best, especially on Android. Here's an updated pen which includes the original bug behavior, a combobox, and a native input: https://codepen.io/kreitlow/pen/wvOazaX?editors=1010 |
I agree that the native experience for datalist-bound inputs has its pain points. Maybe its wishful thinking, but the datalist standard is pretty mature and I think the idea of a truly built-in/native combobox that every browser can use without JavaScript is something that the web sorely needs. Personally, I'm a That aside, the situation for this specific bug leads me to understand that there are 2 possible options for addressing this:
Any thoughts on which direction the Fast team may lean? @radium-v |
Unfortunately |
Hi,
When using the form fields (mainly text field) and adding the
list
attribute, it has no effect.This happens because the data list is outside the shadow while the input element is inside the shadow.
Here's an example that shows the issue:
https://codepen.io/yonatankra/pen/OJQNXpb?editors=1111
In this example, there's a datalist outside the shadow - and the
list
attribute has no effect.Clicking the button appends the same
dataList
into the shadow DOM and you can see the autocomplete shows.Is there different way to make the
list
attribute work?The text was updated successfully, but these errors were encountered: