Skip to content

Commit 7ea8810

Browse files
committed
fix(VTextField, VTextarea): keep input visible for password managers
fixes #21912 closes #20343
1 parent 48da580 commit 7ea8810

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,17 +463,20 @@ describe('VAutocomplete', () => {
463463
expect(input).toHaveAttribute('placeholder', 'Placeholder')
464464

465465
await rerender({ label: 'Label' })
466-
await expect.element(input).not.toBeDisplayed()
466+
await expect.element(input).toBeDisplayed()
467+
expect(Number(window.getComputedStyle(input, '::placeholder').opacity)).toBe(0)
467468

468469
input.focus()
469470
await waitAnimationFrame()
470471
expect(input).toHaveAttribute('placeholder', 'Placeholder')
471472
await expect.element(input).toBeDisplayed()
473+
expect(Number(window.getComputedStyle(input, '::placeholder').opacity)).toBeGreaterThan(0.2)
472474

473475
input.blur()
474476
await rerender({ persistentPlaceholder: true })
475477
expect(input).toHaveAttribute('placeholder', 'Placeholder')
476478
await expect.element(input).toBeDisplayed()
479+
expect(Number(window.getComputedStyle(input, '::placeholder').opacity)).toBeGreaterThan(0.2)
477480

478481
await rerender({ modelValue: 'Foobar' })
479482
expect(input).not.toHaveAttribute('placeholder')

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,16 +493,19 @@ describe('VCombobox', () => {
493493
await expect.element(input).toHaveAttribute('placeholder', 'Placeholder')
494494

495495
await rerender({ label: 'Label' })
496-
await expect.element(input).not.toBeDisplayed()
496+
await expect.element(input).toBeDisplayed()
497+
expect(Number(window.getComputedStyle(input, '::placeholder').opacity)).toBe(0)
497498

498499
await userEvent.click(input)
499500
await expect.element(input).toHaveAttribute('placeholder', 'Placeholder')
500501
await expect.element(input).toBeDisplayed()
502+
expect(Number(window.getComputedStyle(input, '::placeholder').opacity)).toBeGreaterThan(0.2)
501503

502504
await userEvent.tab()
503505
await rerender({ persistentPlaceholder: true })
504506
await expect.element(input).toHaveAttribute('placeholder', 'Placeholder')
505507
await expect.element(input).toBeDisplayed()
508+
expect(Number(window.getComputedStyle(input, '::placeholder').opacity)).toBeGreaterThan(0.2)
506509

507510
await rerender({ modelValue: 'Foobar' })
508511
await expect.element(input).not.toHaveAttribute('placeholder')

packages/vuetify/src/components/VTextField/VTextField.sass

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
.v-text-field
99
input
1010
color: inherit
11-
opacity: 0
1211
flex: $text-field-input-flex
1312
transition: $text-field-input-transition
1413
min-width: 0
@@ -40,16 +39,15 @@
4039
@at-root #{selector.append('.v-text-field--suffixed', &)}
4140
--v-field-padding-start: #{$text-field-input-padding-end}
4241

42+
&:not(.v-field--no-label, .v-field--active)
43+
input::placeholder
44+
opacity: 0
45+
4346
.v-input__details
4447
padding-inline: $text-field-details-padding-inline
4548
@at-root #{selector.append('.v-input--plain-underlined', &)}
4649
padding-inline: 0
4750

48-
.v-field--no-label,
49-
.v-field--active
50-
input
51-
opacity: 1
52-
5351
.v-field--single-line
5452
input
5553
transition: none

packages/vuetify/src/components/VTextarea/VTextarea.sass

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
.v-field
1212
--v-textarea-control-height: var(--v-input-control-height)
1313

14+
&:not(.v-field--no-label, .v-field--active)
15+
input::placeholder
16+
opacity: 0
17+
1418
.v-field__field
1519
--v-input-control-height: var(--v-textarea-control-height)
1620

@@ -40,13 +44,7 @@
4044
.v-field__input
4145
resize: none
4246

43-
.v-field--no-label,
44-
.v-field--active
45-
textarea
46-
opacity: 1
47-
4847
textarea
49-
opacity: 0
5048
flex: 1
5149
min-width: 0
5250
height: 100%

0 commit comments

Comments
 (0)