Fix person removal from Combobox/Listbox demos (#1603)
* Fix person removal from Combobox/Listbox demos * Reset query on focus for Combobox demo with multiple items
This commit is contained in:
@@ -77,6 +77,7 @@ function MultiPeopleList() {
|
||||
))}
|
||||
<Combobox.Input
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
onFocus={() => query != '' && setQuery('')}
|
||||
className="border-none p-0 focus:ring-0"
|
||||
placeholder="Search..."
|
||||
/>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@click="removePerson(person)"
|
||||
@click.stop.prevent="removePerson(person)"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
@@ -39,6 +39,7 @@
|
||||
</span>
|
||||
<ComboboxInput
|
||||
@change="query = $event.target.value"
|
||||
@focus="query = ''"
|
||||
class="border-none p-0 focus:ring-0"
|
||||
placeholder="Search..."
|
||||
/>
|
||||
@@ -151,9 +152,7 @@ function onSubmit(e) {
|
||||
console.log([...new FormData(e.currentTarget).entries()])
|
||||
}
|
||||
|
||||
function removePerson() {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
function removePerson(person) {
|
||||
activePersons.value = activePersons.value.filter((p) => p !== person)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@click="removePerson(person)"
|
||||
@click.stop.prevent="removePerson(person)"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
@@ -143,9 +143,7 @@ function onSubmit(e) {
|
||||
console.log([...new FormData(e.currentTarget).entries()])
|
||||
}
|
||||
|
||||
function removePerson() {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
function removePerson(person) {
|
||||
activePersons.value = activePersons.value.filter((p) => p !== person)
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user