PolymerElements / paper-icon-button

A Material Design icon button
https://www.webcomponents.org/element/PolymerElements/paper-icon-button
42 stars 44 forks source link

Setting alt property to undefined breaks link to aria-label #153

Open Tronil opened 5 years ago

Tronil commented 5 years ago

Description

If you at any time set the paper-icon-button alt property to undefined (which is easily done when using bindings), it stops updating the aria-label attribute and it gets stuck with the value "undefined".

The problem is in the guard that checks the old value against the current value of the aria-label attribute (the oldValue == label comparison) - it doesn't handle non-string values correctly. oldValue should be converted to a string before comparing.

Expected outcome

Changing the alt property should update the aria-label attribute.

Actual outcome

aria-label will keep having "undefined" as value

Steps to reproduce

  1. Put a paper-icon-button element in the page.
  2. Set the alt property to undefined
  3. Set the alt property to "Some text"