<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/web-components-still-need-to-be-accessible-jehq4uqwo" -->

---
title: Web Components Still Need to be Accessible | daily.dev
description: Web components offer a way to create reusable, consistent UI patterns, but that reusability is meaningless if the underlying markup isn't accessible. Using a...
canonical: https://daily.dev/posts/web-components-still-need-to-be-accessible-jehq4uqwo
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Web Components Still Need to be Accessible | daily.dev
og:description: Web components offer a way to create reusable, consistent UI patterns, but that reusability is meaningless if the underlying markup isn't accessible. Using a...
og:url: https://daily.dev/posts/web-components-still-need-to-be-accessible-jehq4uqwo
og:image: https://api.daily.dev/og/posts/Jehq4uqWo.png
og:image:alt: Web Components Still Need to be Accessible
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Web Components Still Need to be Accessible

**[Eric Bailey](https://daily.dev/sources/ericwbailey)** · 7 min read · 0 upvotes · 0 comments

## Summary

Web components offer a way to create reusable, consistent UI patterns, but that reusability is meaningless if the underlying markup isn't accessible. Using a toggle button as an example, semantic HTML elements and ARIA attributes like aria-pressed should form the foundation, since custom elements ultimately render as plain HTML that either works for assistive technology users or doesn't. Developers are urged to avoid reinventing native elements, test with real assistive technology, and check for existing accessible implementations before building their own components.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.24a11y.com/2018/web-components-still-need-to-be-accessible>

## Questions this post answers

### How do I make a toggle button component accessible using ARIA?

Use a native button element with an aria-pressed attribute set to true or false to convey state, rather than a div with a role='button' or an unstyled div with no semantics. The button element automatically announces its role to assistive technologies, aria-pressed can also serve as a CSS styling hook via attribute selectors, and the visible label text gives the button an accessible name.

_daily.dev surfaces accessibility patterns like this for developers building custom UI components._

### Why should I avoid recreating native HTML elements like select with divs and JavaScript in a web component?

Native elements are far more fault-tolerant than custom-built replacements because browsers have already handled years of edge cases, keyboard interactions, and platform-specific behaviors, such as how select elements render differently on mobile. Recreating that behavior from scratch with divs and spans requires significantly more JavaScript and still risks missing expected behaviors, increasing both development effort and long-term risk.

_developers weighing custom widgets versus native elements can find this kind of tradeoff analysis on daily.dev._

## Similar posts on daily.dev

- [Building Better Buttons](https://daily.dev/posts/building-better-buttons-kfg2u6xfq) · Simple Thread · 68 upvotes · 5 comments
- [I Learned The First Rule of ARIA the Hard Way](https://daily.dev/posts/i-learned-the-first-rule-of-aria-the-hard-way-bf3esumgq) · CSS-Tricks · 210 upvotes · 12 comments
- [Why Accessibility Is An Operational Capability, Not A Feature — Smashing Magazine](https://daily.dev/posts/why-accessibility-is-an-operational-capability-not-a-feature-smashing-magazine-vush3kmuc) · Smashing Magazine · 5 upvotes · 0 comments
- [If you want to create a button from scratch, you must first create the universe](https://daily.dev/posts/if-you-want-to-create-a-button-from-scratch-you-must-first-create-the-universe-81uyduuo1) · Hacker News · 2 upvotes · 1 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#html](https://daily.dev/tags/html), [#accessibility](https://daily.dev/tags/accessibility), [#web-components](https://daily.dev/tags/web-components)

[View this post on daily.dev](https://daily.dev/posts/web-components-still-need-to-be-accessible-jehq4uqwo)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Web Components Still Need to be Accessible","url":"https://daily.dev/posts/web-components-still-need-to-be-accessible-jehq4uqwo","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/web-components-still-need-to-be-accessible-jehq4uqwo"},"datePublished":"2026-09-20T07:44:01.034Z","dateModified":"2026-09-20T07:46:06.326Z","description":"Web components offer a way to create reusable, consistent UI patterns, but that reusability is meaningless if the underlying markup isn't accessible. Using a...","image":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","thumbnailUrl":"https://media.daily.dev/image/upload/s--VDukGCjf--/f_auto/v1722860399/public/Placeholder%2002","isAccessibleForFree":true,"articleSection":"Eric Bailey","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Eric Bailey","logo":"https://media.daily.dev/image/upload/s--r1vwe6z1--/f_auto,q_auto/v1789890198/logos/ericwbailey?_a=BAMAMicg0","url":"https://daily.dev/sources/ericwbailey"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/web-components-still-need-to-be-accessible-jehq4uqwo","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript,html,accessibility,web-components","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Eric Bailey","item":"https://daily.dev/sources/ericwbailey"},{"@type":"ListItem","position":3,"name":"Web Components Still Need to be Accessible"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/web-components-still-need-to-be-accessible-jehq4uqwo#faq","mainEntity":[{"@type":"Question","name":"How do I make a toggle button component accessible using ARIA?","acceptedAnswer":{"@type":"Answer","text":"Use a native button element with an aria-pressed attribute set to true or false to convey state, rather than a div with a role='button' or an unstyled div with no semantics. The button element automatically announces its role to assistive technologies, aria-pressed can also serve as a CSS styling hook via attribute selectors, and the visible label text gives the button an accessible name. daily.dev surfaces accessibility patterns like this for developers building custom UI components."}},{"@type":"Question","name":"Why should I avoid recreating native HTML elements like select with divs and JavaScript in a web component?","acceptedAnswer":{"@type":"Answer","text":"Native elements are far more fault-tolerant than custom-built replacements because browsers have already handled years of edge cases, keyboard interactions, and platform-specific behaviors, such as how select elements render differently on mobile. Recreating that behavior from scratch with divs and spans requires significantly more JavaScript and still risks missing expected behaviors, increasing both development effort and long-term risk. developers weighing custom widgets versus native elements can find this kind of tradeoff analysis on daily.dev."}}]}
```

