Native vs Custom: When to Reach for a Real Element
Why a real button beats a styled span every time.
Native vs Custom: When to Reach for a Real Element is a free Web Accessibility Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Web Accessibility Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Core Choice
For any control you face one choice: use a native HTML element or hand-build a custom one. Native almost always wins.
A Real Button Just Works
A native button is focusable, clickable by mouse, keyboard, and touch, and announced correctly. You write one tag and the platform does the rest.
<button>Buy now</button>A Styled span Does Not
Style a span to look like a button and it still has no role, no focus, and no keyboard support. It only fools the eye.
<span class="button">Buy now</span>The Cost of Custom
To make a custom control work you must add a role, tabindex, and key handlers for Enter and Space. That is a lot of code to match one tag.
<span role="button" tabindex="0">Buy now</span>And You Will Forget Something
Even careful custom controls miss edge cases: focus rings, disabled states, touch. The native element already handles every one of them.
Native Goes Beyond Buttons
This holds for the whole platform. A real select, checkbox, or details gives you behavior and accessibility that a div imitation never fully matches.
<input type="checkbox"> Remember meForms Love Native
Native form controls submit with the form, validate themselves, and pair with a label automatically. Rebuilding that by hand is rarely worth it.
When Custom Is Justified
Go custom only when no native element exists for the pattern, like a tabbed interface or a tree. Then follow a proven authoring pattern carefully.
Style Native Freely
Worried a real button looks plain? You can style native elements heavily with CSS. Keep the semantics, change the skin to anything you like.
Less Code, More Robust
Reaching for the real element means less JavaScript, fewer bugs, and a control that survives browser and assistive tech updates for free.
The Default Rule
Make it your default: native first, custom only as a last resort. The web platform is a huge accessibility gift, so let it do the work.
Quick Check
Let us decide native or custom.
Recap
Choose native first: a real button or input gives you focus, keys, and semantics for free. Go custom only when no element exists, and style native freely. 🎉
Frequently asked questions
Is the “Native vs Custom: When to Reach for a Real Element” lesson free?
Yes — the full text of “Native vs Custom: When to Reach for a Real Element” is free to read here on the web, and the Web Accessibility Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Web Accessibility Academy course, upgrade to CoddyKit PRO.
What will I learn in “Native vs Custom: When to Reach for a Real Element”?
Why a real button beats a styled span every time. You practise Web Accessibility Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Web Accessibility Academy?
No prior experience is required. Web Accessibility Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Native vs Custom: When to Reach for a Real Element” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Web Accessibility Academy lesson?
Yes. Every Web Accessibility Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Tags Have Meaning: Why div Soup Fails
- Text Elements: Paragraphs, Lists, and Emphasis
- The Accessibility Tree: What Screen Readers Hear
- Native vs Custom: When to Reach for a Real Element