3 ms·
You're wrong, and in a pretty obvious way. It's actually like asking what a database library will do to prevent SQL injection attacks. And the answer is simple
by nindalf 2y ago
You're wrong, and in a pretty obvious way.
It's actually like asking what a database library will do to prevent SQL injection attacks. And the answer is simple - "don't do string interpolation yourself, instead use the `(?, ?)` syntax". If you use that the SQL escaping will be taken care of automatically by the library. If the database library said something idiotic like "read the spec and implement your own SQL escaping logic" it would be a dereliction of duty.
Make no mistake, a frontend library like htmx has a responsibility to not break the front end from an accessibility perspective. If existing screenreaders break when you replace HTML then the htmx approach is broken and htmx needs to address that.
- yawaramin 2y agoConceptually htmx is closer to Fetch API + set innerHTML than it is to a 'frontend library' like React.js. Do people complain that setting innerHTML from JavaScript breaks screen readers? Of course not, they set up aria-live regions correctly as shown in plenty of accessibility documentation. htmx can't make the decision for you what your aria-live regions are and what text should be read out when the content changes, you need to decide that yourself. EDIT: here's the one mention of `aria-live` in the React.js codebase defining it as a valid ARIA attribute for ReactDOM: https://github.com/search?q=repo%3Afacebook%2Freact%20%22aria-live%22&type=code https://github.com/search?q=repo%3Afacebook%2Freact%20%22ari... The one mention in Vuejs core to define its accepted values: https://github.com/search?q=repo%3Avuejs%2Fcore%20%22aria-live%22&type=code https://github.com/search?q=repo%3Avuejs%2Fcore%20%22aria-li... The one mention in the Svelte runtime defining its accepted values: https://github.com/search?q=repo%3Asveltejs%2Fsvelte%20%22aria-live%22&type=code https://github.com/search?q=repo%3Asveltejs%2Fsvelte%20%22ar... Do people go after these frameworks saying they need to handle breaking screenreaders by dynamically updating content? Of course not. Setting live regions is the responsibility of the web page creator, not the framework.
- simonw 2y agoYes, I do go after those frameworks saying they need to at the very least help their users understand what they should do. I'm disappointed by any JavaScript library or framework that doesn't provide good documented examples for this, which is almost all of them.
- yawaramin 2y ago> Yes, I do go after those frameworks I'll believe that once I see you file an issue which mentions accessibility against any of the projects I linked to ;-) https://github.com/facebook/react/issues?q=is%3Aissue+author%3Asimonw https://github.com/facebook/react/issues?q=is%3Aissue+author... https://github.com/vuejs/core/issues?q=is%3Aissue+author%3Asimonw https://github.com/vuejs/core/issues?q=is%3Aissue+author%3As... https://github.com/sveltejs/svelte/issues?q=is%3Aissue+author%3Asimonw https://github.com/sveltejs/svelte/issues?q=is%3Aissue+autho...
- nindalf 2y agoSimon don’t waste your time with this guy. I thought he was affiliated with htmx but he’s just some jerk off trying to prove he’s “right”.
- yawaramin 2y agoI encourage you to read the guidelines and familiarize yourself with what is acceptable in HN comments: https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- nindalf 2y agoYou're right, thanks for the reminder. Simon don’t waste your time with this guy. I thought he was affiliated with htmx but he’s just some dude trying to prove he’s “right”.
- yawaramin 2y agoBeing affiliated with htmx or not doesn't change basic facts about web accessibility :-D Go look at the links I posted, look for the issues people filed against the repos claiming that their dynamic content updates break screen readers. There are zero. People understand how web accessibility works and what responsibilities lie at which parts of their stack. Now if you say that component frameworks like shadcn/ui or whatnot should implement accessible behaviours and patterns, I am 100% with you on that. But React/Vue/htmx are at a lower level, they can't decide those things for you. EDIT: sure enough, someone filed an issue with shadcn/ui that it does not announce something properly in screenreaders: https://github.com/shadcn-ui/ui/issues/4209 https://github.com/shadcn-ui/ui/issues/4209