Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipe label through to aria-labels #549

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 2 additions & 11 deletions paper-textarea.html
Expand Up @@ -55,10 +55,10 @@
disabled$="[[disabled]]"
invalid="[[invalid]]">

<label hidden$="[[!label]]" aria-hidden="true" for="input" slot="label">[[label]]</label>
<label hidden$="[[!label]]" aria-hidden="true" slot="label">[[label]]</label>

<iron-autogrow-textarea id="input" class="paper-input-input" slot="input"
aria-labelledby$="[[_ariaLabelledBy]]"
label="[[label]]"
aria-describedby$="[[_ariaDescribedBy]]"
bind-value="{{value}}"
invalid="{{invalid}}"
Expand Down Expand Up @@ -100,11 +100,6 @@
],

properties: {
_ariaLabelledBy: {
observer: '_ariaLabelledByChanged',
type: String
},

_ariaDescribedBy: {
observer: '_ariaDescribedByChanged',
type: String
Expand Down Expand Up @@ -136,10 +131,6 @@
}
},

_ariaLabelledByChanged: function(ariaLabelledBy) {
this.$.input.textarea.setAttribute('aria-labelledby', ariaLabelledBy);
},

_ariaDescribedByChanged: function(ariaDescribedBy) {
this.$.input.textarea.setAttribute('aria-describedby', ariaDescribedBy);
},
Expand Down
6 changes: 3 additions & 3 deletions test/paper-textarea.html
Expand Up @@ -207,10 +207,10 @@

suite('a11y', function() {

test('has aria-labelledby', function() {
test('has aria-label', function() {
var input = fixture('label');
assert.isTrue(input.inputElement.textarea.hasAttribute('aria-labelledby'))
assert.equal(input.inputElement.textarea.getAttribute('aria-labelledby'), Polymer.dom(input.root).querySelector('label').id, 'aria-labelledby points to the label');
assert.isTrue(input.inputElement.textarea.hasAttribute('aria-label'))
assert.equal(input.inputElement.textarea.getAttribute('aria-label'), input.label, 'paper-textarea passes through label to aria-label');
});

test('has aria-describedby for error message', function(done) {
Expand Down