Skip to content

Commit

Permalink
feat(textfield): support inputmode attribute
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 557881129
  • Loading branch information
asyncLiz authored and copybara-github committed Aug 17, 2023
1 parent faeb89e commit 5d0cbf5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions textfield/internal/text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export abstract class TextField extends LitElement {
}

// <input> properties
@property({reflect: true}) override inputMode = '';
/**
* Defines the greatest value in the range of permitted values.
*
Expand Down Expand Up @@ -616,8 +617,10 @@ export abstract class TextField extends LitElement {
const prefix = this.renderPrefix();
const suffix = this.renderSuffix();

// TODO(b/243805848): remove `as unknown as number` once lit analyzer is
// fixed
// TODO(b/243805848): remove `as unknown as number` and `as any` once lit
// analyzer is fixed
// tslint:disable-next-line:no-any
const inputMode = this.inputMode as any;
return html`
<div class="input-wrapper">
${prefix}
Expand All @@ -628,6 +631,7 @@ export abstract class TextField extends LitElement {
aria-invalid=${this.hasError}
aria-label=${ariaLabel}
?disabled=${this.disabled}
inputmode=${inputMode || nothing}
max=${(this.max || nothing) as unknown as number}
maxlength=${this.maxLength > -1 ? this.maxLength : nothing}
min=${(this.min || nothing) as unknown as number}
Expand Down

0 comments on commit 5d0cbf5

Please sign in to comment.