Skip to content

Commit

Permalink
chore(field): remove field ID property
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 465328988
  • Loading branch information
asyncLiz authored and copybara-github committed Aug 4, 2022
1 parent f94a452 commit f8d950f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
1 change: 0 additions & 1 deletion textfield/filled-text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class MdFilledTextField extends FilledTextField {
return html`
<md-filled-field
class="md3-text-field__field"
id=${this.fieldId}
?disabled=${this.disabled}
?error=${this.error}
?hasEnd=${this.hasTrailingIcon}
Expand Down
1 change: 0 additions & 1 deletion textfield/lib/filled-text-field_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class TestTextField extends FilledTextField {
return html`
<md-filled-field
class="md3-text-field__field"
id=${this.fieldId}
?disabled=${this.disabled}
.error=${this.error}
.label=${this.label}
Expand Down
1 change: 0 additions & 1 deletion textfield/lib/outlined-text-field_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class TestTextField extends OutlinedTextField {
return html`
<md-outlined-field
class="md3-text-field__field"
id=${this.fieldId}
?disabled=${this.disabled}
.error=${this.error}
.label=${this.label}
Expand Down
13 changes: 6 additions & 7 deletions textfield/lib/text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ export class TextField extends LitElement {
* An optional suffix to display after the input value.
*/
@property({type: String}) suffixText = '';
/**
* The ID on the field element, used for SSR.
*/
@property({type: String}) fieldId = 'field';
/**
* Whether or not the text field has a leading icon. Used for SSR.
*/
Expand Down Expand Up @@ -202,14 +198,17 @@ export class TextField extends LitElement {
// TODO(b/237281840): replace ternary operators with double pipes
// TODO(b/237283903): remove when custom isTruthy directive is supported
const placeholderValue = this.placeholder ? this.placeholder : undefined;
const ariaLabelValue = this.ariaLabel ? this.ariaLabel :
this.label ? this.label :
undefined;
const ariaLabelledByValue =
this.ariaLabelledBy ? this.ariaLabelledBy : this.fieldId;
this.ariaLabelledBy ? this.ariaLabelledBy : undefined;

return html`<input
class="md3-text-field__input"
aria-invalid=${this.error}
aria-label=${ifDefined(this.ariaLabel)}
aria-labelledby=${ariaLabelledByValue}
aria-label=${ifDefined(ariaLabelValue)}
aria-labelledby=${ifDefined(ariaLabelledByValue)}
?disabled=${this.disabled}
placeholder=${ifDefined(placeholderValue)}
?readonly=${this.readonly}
Expand Down
1 change: 0 additions & 1 deletion textfield/lib/text-field_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class TestTextField extends TextField {
return html`
<md-filled-field
class="md3-text-field__field"
id=${this.fieldId}
?disabled=${this.disabled}
.error=${this.error}
.label=${this.label}
Expand Down
1 change: 0 additions & 1 deletion textfield/outlined-text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class MdOutlinedTextField extends OutlinedTextField {
return html`
<md-outlined-field
class="md3-text-field__field"
id=${this.fieldId}
?disabled=${this.disabled}
?error=${this.error}
?hasEnd=${this.hasTrailingIcon}
Expand Down

0 comments on commit f8d950f

Please sign in to comment.