Skip to content

Commit

Permalink
Set inner input value instead of attribute
Browse files Browse the repository at this point in the history
The native `input` value property and the `value` attribute have
different effects. The `value` attribute is the default value, while
the property represents the actual value.
  • Loading branch information
bendera committed Jan 31, 2025
1 parent 2b36bce commit c88efbb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/vscode-textfield/vscode-textfield.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('vscode-textfield', () => {
expect(el).shadowDom.to.equal(
`
<slot name="content-before"></slot>
<input aria-label="" id="input" type="text" value="">
<input aria-label="" id="input" type="text">
<slot name="content-after"></slot>
`
);
Expand Down
2 changes: 1 addition & 1 deletion src/vscode-textfield/vscode-textfield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export class VscodeTextfield
?readonly=${this.readonly}
?required=${this.required}
step=${ifDefined(this.step)}
value=${ifDefined(this.type !== 'file' ? this._value : undefined)}
.value=${this._value}
@blur=${this._onBlur}
@change=${this._onChange}
@focus=${this._onFocus}
Expand Down

0 comments on commit c88efbb

Please sign in to comment.