cem-autocomplete features #71
Replies: 2 comments
-
Implementation notesTo support focus-able list items implementation can wrap each item into:
Link does not have a
The use of same <form id="myform" onsubmit="alert( (new FormData(myform)).get('pick') )">
<input name="pick"/>
<label><input type="radio" value="apple" name="pick">🍎</label>
<label><input type="radio" value="pear" name="pick">🍐</label>
<button type="submit" >Submit</button>
</form> In example ^^ the |
Beta Was this translation helpful? Give feedback.
-
list handlingThe list needs own container in order to be popover. FORM as container would give ability to trigger Hence insteaf of form change, the radio handler should trigger the input propagation. Radio would select only one from group if the group has same How to handle the radio name if none is assigned to INPUT? The generated name would work for single selection, but would have a side effect of introduced value on the container FORM. To avoid such side effect the FIELDSET also able to receive <form id="myform" onsubmit="event.preventDefault(); console.log( myform.pick[0].value )">
<input name="pick"/>
<fieldset form="fakeorm" onchange="console.log( myform.pick[0].value = event.target.value )">
<label><input type="radio" value="apple" name="pick">🍎</label>
<label><input type="radio" value="pear" name="pick">🍐</label>
</fieldset>
<button type="submit" >Submit</button>
</form> |
Beta Was this translation helpful? Give feedback.
-
cem-autocomplete,
custom-element
Materialcem-autocomplete
is an input field with associated data list shown as dropdown on focus and filtered by text dynamically while typing.The behavior and appearance is following the datalist element.
Unlike native
datalist
, thecem-autocomplete
allows custom DOM for input field and list items.Features
value
property and attributeupdated synchronously with input. When the text of input matches the item text, the value is taken from
value
property of item.Q. Would
value
be set to partial text or closest/autoselected list item one?change
eventemitted on
change
event by input field.slot="input"
defines input filed withvalue
property and emitstype
andchange
eventsBy default it is a
<input type="search">
slot=""
defines the list of suggested valuesdata or time are sugessted elements to hold the value.
See also
cem-select
Beta Was this translation helpful? Give feedback.
All reactions