Description
Minimal example
Fork this JSFiddle and reproduce your issue.
See https://jsfiddle.net/rj28m1ao/1/
See related #680
Expected behaviour
When using data-clipboard-text
, ClipboardJS adds a visually hidden textarea into the DOM, typically before the closing </body>
tag. I expected the visually hidden textarea to be removed on success.
Actual behaviour
The textarea lingers in the DOM. Screen readers and other assistive technologies will still perceive and announce the unlabelled textarea, even if it's visually hidden. This isn't ideal for assistive technology users as they get a textarea with no label that has no apparent purpose. Pretty confusing.
Seems to me that on success the visually hidden textarea isn't really needed any longer. On following copy actions it will be re-added into the DOM anyways so it would be best to remove it on success.
See related WordPress Trac ticket https://core.trac.wordpress.org/ticket/50322 where I added a patch that explicitly calls clipboardAction.removeFake()
on success to remove the textarea. It would be great if this would be the default behavior on success.
Activity