Merge pull request #301 from noventadev/feat/field-aria-live
[field] Add aria-live=polite attribute to feedback slot
This commit is contained in:
commit
014751d1ee
2 changed files with 12 additions and 0 deletions
|
|
@ -139,6 +139,7 @@ export const FormControlMixin = dedupeMixin(
|
|||
}
|
||||
}
|
||||
if (_feedbackNode) {
|
||||
_feedbackNode.setAttribute('aria-live', 'polite');
|
||||
_feedbackNode.id = _feedbackNode.id || `feedback-${this._inputId}`;
|
||||
const describeIdFeedback = ` ${_feedbackNode.id}`;
|
||||
if (this._ariaDescribedby.indexOf(describeIdFeedback) === -1) {
|
||||
|
|
|
|||
|
|
@ -62,4 +62,15 @@ describe('FormControlMixin', () => {
|
|||
expect(hasDuplicate).to.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
it('adds aria-live="politie" to the feedback slot', async () => {
|
||||
const lionField = await fixture(html`
|
||||
<${tag}>
|
||||
${inputSlot}
|
||||
<div slot="feedback">Added to see attributes</div>
|
||||
</${tag}>
|
||||
`);
|
||||
|
||||
expect(lionField.$$slot('feedback').getAttribute('aria-live')).to.equal('polite');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue