A custom control can look right and still be difficult to use. A keyboard user may be unable to reach it or see where focus has moved; a screen reader user may not learn what it does or whether it is selected. Native HTML controls already provide tested semantics and behavior, so start there. section 2.5.1 section 5.3.1
A button without the extra work
For a Save changes action, use a <button> rather than a <div> styled as one. The generic container needs an assigned role, a place in the tab order, and keyboard event handling. The native button avoids that reconstruction. The same trade-off applies to a date picker: styling freedom must be weighed against the work of building, testing, and maintaining accessible behavior. section 2.5.1
When no suitable native control exists, expose the custom control’s purpose and state with ARIA roles, states, properties, and labels. ARIA describes a control to assistive technologies; it does not supply the interaction. Implement the expected keyboard behavior and focus management as well. The WAI-ARIA Authoring Practices Guide provides patterns and working examples to consult before building from scratch. section 2.5.2
Listing 2.2 Tabbed interface implemented in HTML, including ARIA attributes
...
<main>
<section class="tabs">
<!-- TABS -->
<div role="tablist" #A
aria-label="Product Specifications"
id="specs-tabs">
<button type="button" role="tab" #B
aria-selected="true" #C
aria-controls="panel-1" #D
id="tab-1"
tabindex="0"> #E
Overview
</button>
<button type="button" role="tab"
aria-selected="false"
aria-controls="panel-2"
id="tab-2"
tabindex="-1"> #F
Technical Specifications
</button>
</div>
<!-- PANELS -->
<div role="tabpanel" #G
id="panel-1"
tabindex="0" #H
aria-labelledby="tab-1"> #I
<p>
This product is lovely, durable and designed for
something - not sure yet. Comes with a 25-year
all-in warranty.
</p>
<p>
This is a <a href="#">focusable</a> element.
</p>
<img src="images/TabInterface.jpg"
alt="Close up of red object"
class="product_image" />
</div>
<div role="tabpanel"
id="panel-2"
tabindex="0"
aria-labelledby="tab-2"
hidden> #J
<ul>
<li>Dimensions: 100 × 200 × 15mm</li>
<li>Weight: 15Kg</li>
</ul>
</div>
</section>
</main>
...
The tabbed-interface markup pairs a labeled tab list with tabs and panels. Roles identify each part; aria-selected reports the active tab, while aria-controls and aria-labelledby connect tabs to their panels. section 2.5.2
Markup is only part of that tab control. Its JavaScript handles arrow, Home, and End keys; updates selection and which panel is hidden; and moves focus when appropriate. Keep focus clearly visible, too. A faint indicator can force someone who loses their place to retrace the tab order. Retain the browser’s focus indicator or replace it with one that is easier to see—do not simply remove it. section 2.5.2 section 5.3.1

