Make screen reader announce when API key is copied

Currently screen reader users would click the ‘Copy API key’ button but
not get any feedback. This commit adds an ARIA attribute which tells the
screenreader to announce any changes in to the content of the element
(eg when it changes from showing the API to showing the text ‘API key
copied to clipboard’).
This commit is contained in:
Chris Hill-Scott
2017-02-13 14:05:03 +00:00
parent 71e1262293
commit ffab83729c

View File

@@ -2,7 +2,7 @@
<h2 class="api-key-name">
{{ name }}
</h2>
<div data-module="api-key" data-key="{{ key }}" data-thing="{{ thing }}">
<div data-module="api-key" data-key="{{ key }}" data-thing="{{ thing }}" aria-live="assertive">
<span class="api-key-key">{{ key }}</span>
</div>
{% endmacro %}