Skip to content

Commit ec4dfc1

Browse files
authored
fix(VSelect, VAutocomplete, VCombobox): open menu on icon click (#21617)
Fixes #21607 This reverts commit 1452442.
1 parent 0378bc2 commit ec4dfc1

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

packages/vuetify/src/components/VField/VField.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,7 @@ export const VField = genericComponent<new <T>(
278278
/>
279279

280280
{ hasPrepend && (
281-
<div
282-
key="prepend"
283-
class="v-field__prepend-inner"
284-
onMousedown={ (e: MouseEvent) => {
285-
e.preventDefault()
286-
e.stopPropagation()
287-
}}
288-
>
281+
<div key="prepend" class="v-field__prepend-inner">
289282
{ props.prependInnerIcon && (
290283
<InputIcon
291284
key="prepend-icon"
@@ -377,14 +370,7 @@ export const VField = genericComponent<new <T>(
377370
)}
378371

379372
{ hasAppend && (
380-
<div
381-
key="append"
382-
class="v-field__append-inner"
383-
onMousedown={ (e: MouseEvent) => {
384-
e.preventDefault()
385-
e.stopPropagation()
386-
}}
387-
>
373+
<div key="append" class="v-field__append-inner">
388374
{ slots['append-inner']?.(slotProps.value) }
389375

390376
{ props.appendInnerIcon && (

packages/vuetify/src/components/VSelect/__tests__/VSelect.spec.browser.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,26 @@ const stories = Object.fromEntries(Object.entries({
4646
)]))
4747

4848
describe('VSelect', () => {
49+
it('should toggle menu with dropdown icon', async () => {
50+
const { element } = render(() => (
51+
<VSelect items={['Item #1', 'Item #2']} />
52+
))
53+
54+
const menuIcon = screen.getByCSS('.v-icon')
55+
expect(screen.queryAllByCSS('.v-list-item')).toHaveLength(0)
56+
expect(element).not.toHaveClass('v-select--active-menu')
57+
58+
await userEvent.click(menuIcon)
59+
await commands.waitStable('.v-list')
60+
expect(screen.queryAllByCSS('.v-list-item')).toHaveLength(2)
61+
expect(element).toHaveClass('v-select--active-menu')
62+
63+
await userEvent.click(menuIcon)
64+
await commands.waitStable('.v-list')
65+
expect(screen.queryAllByCSS('.v-list-item')).toHaveLength(0)
66+
expect(element).not.toHaveClass('v-select--active-menu')
67+
})
68+
4969
it('should render selection slot', () => {
5070
const items = [
5171
{ title: 'a' },

0 commit comments

Comments
 (0)