Skip to content

Commit

Permalink
fix(button): Remove aria-label and aria-haspopup attributes from …
Browse files Browse the repository at this point in the history
…Button HTML if not set

`@ariaProperty` uses `''` as a default value for the property, therefore the `ifDefined` directive was doing nothing.

PiperOrigin-RevId: 470843522
  • Loading branch information
kvizcarra authored and copybara-github committed Aug 29, 2022
1 parent c0d107e commit 5e2a46e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions button/lib/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ export abstract class Button extends ActionElement implements ButtonState {
* @soyAttributes buttonAttributes: .md3-button
*/
protected override render(): TemplateResult {
// TODO(b/237283903): Replace ifDefined(... || undefined) with ifTruthy(...)
return html`
<button
class="md3-button ${classMap(this.getRenderClasses())}"
?disabled="${this.disabled}"
aria-label="${ifDefined(this.ariaLabel)}"
aria-haspopup="${ifDefined(this.ariaHasPopup)}"
aria-label="${ifDefined(this.ariaLabel || undefined)}"
aria-haspopup="${ifDefined(this.ariaHasPopup || undefined)}"
@focus="${this.handleFocus}"
@blur="${this.handleBlur}"
@pointerdown="${this.handlePointerDown}"
Expand Down

0 comments on commit 5e2a46e

Please sign in to comment.