[program-l] Announcement acknowledging button press

  • From: Vaibhav Saraf <vaibhav.s.acc@xxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Thu, 29 Apr 2021 10:18:20 +0530

Hi List Members,

I am preparing a small demo using HTML / JS, and have implemented a 'Copy'
button on a text box which will copy the contents within on the clipboard.

Another requirement is that it should announce 'Text Copied' or something
everytime the button is pressed as an acknowledgement.

I have put aria-live region for the same and populating the text from JS,
but the problem is that the innerHTML gets loaded on the first button press
and announces nothing on subsequent presses as the acknowledgement remain
the same. I have tried making the innerHTML null and assigning the value
again, resetting the aria-live;s polite value, but none worked probably
because all that is happening with one JS call.

What is an optimal way to achieve this?

Thanks,
Vaibhav

Other related posts: