Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #328 a11y - add aria-hidden to hidden textarea #329

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

endlacer
Copy link
Contributor

closes #328

ta.style.height = '1px';
ta.style.width = '1px';
ta.style.overflow = 'hidden';
ta.style.clip = 'rect(0 0 0 0);';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxisam maxisam merged commit 79884e6 into maxisam:master Oct 11, 2024
1 check passed
@endlacer
Copy link
Contributor Author

Can you say when you're doning to release the new version to npm?

@maxisam
Copy link
Owner

maxisam commented Oct 15, 2024

https://www.npmjs.com/package/ngx-clipboard/v/16.1.1-beta.0

please let me know if it works, thx!

@endlacer
Copy link
Contributor Author

good that you made a beta first! now there is a console error even consering a11y:
Blocked aria-hidden on a <textarea> element because the element that just received focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden. <textarea readonly aria-hidden=​"true" style=​"font-size:​ 12pt;​ height:​ 1px;​ width:​ 1px;​ overflow:​ hidden;​ border:​ 0px;​ padding:​ 0px;​ margin:​ 0px;​ position:​ absolute;​ left:​ -9999px;​ top:​ 0px;​">​</textarea>​

So it complains that we focus a aria-hidden element. This is a bummer. I can look into this when I have the time.
Question: Why do we even do this textarea hack, what is the reason not just doing navigator.clipboard.writeText?

And if it is necessary (iOS/Safari eg), does it need to be a formelement to copy from? Can't we copy from a div (no focus shenanigans, therefor no a11y concerns)

@maxisam
Copy link
Owner

maxisam commented Oct 16, 2024

I think it was for backward compatibility but i am not sure now. This project has been a long time. I don't even know if I should just deprecated it, because material has clipboard now as well https://material.angular.io/cdk/clipboard/overview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A11y for the Textbox Element
2 participants