From a27c7eaecd520aaeb505d0d33c799d14d96d7bfd Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Wed, 7 Sep 2016 22:29:53 +0200 Subject: [PATCH] Make sure an explicitly set aria-label attribute is not overwritten by the heading property --- paper-card.html | 8 ++++-- test/basic.html | 66 +++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 64 insertions(+), 10 deletions(-) diff --git a/paper-card.html b/paper-card.html index ba9894c..ce3163a 100644 --- a/paper-card.html +++ b/paper-card.html @@ -229,8 +229,12 @@ }, _headingChanged: function(heading) { - var label = this.getAttribute('aria-label'); - this.setAttribute('aria-label', heading); + var currentHeading = this.getAttribute('heading'), + currentLabel = this.getAttribute('aria-label'); + + if (typeof currentLabel !== 'string' || currentLabel === currentHeading) { + this.setAttribute('aria-label', heading); + } }, _computeHeadingClass: function(image) { diff --git a/test/basic.html b/test/basic.html index 2f35c11..08be42b 100644 --- a/test/basic.html +++ b/test/basic.html @@ -34,21 +34,71 @@ + + + + + + + +