[example] add announcement of text being copied
This commit is contained in:
Родитель
a04305832e
Коммит
bd69de3fb8
|
@ -35,8 +35,10 @@
|
|||
<script>
|
||||
document.addEventListener('clipboard-copy', function (event) {
|
||||
const notice = event.target.querySelector('.notice')
|
||||
announce.setAttribute('aria-label', 'Copied');
|
||||
notice.hidden = false
|
||||
setTimeout(function () {
|
||||
announce.setAttribute('aria-label', '');
|
||||
notice.hidden = true
|
||||
}, 1000)
|
||||
})
|
||||
|
@ -45,6 +47,7 @@
|
|||
<body>
|
||||
<main aria-labelledby="h">
|
||||
<h1 id="h">Demo</h1>
|
||||
<div aria-live="polite" id="announce"></div>
|
||||
<section>
|
||||
<p>Copy from <code>value</code> attribute:</p>
|
||||
<clipboard-copy value="@hubot copied from [value]">
|
||||
|
|
Загрузка…
Ссылка в новой задаче