-
Notifications
You must be signed in to change notification settings - Fork 113
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
Use native HTML elements where possible #322
Comments
I'm not certain that the ARIA rules are true requirements? They might just be guidelines? |
@CalinDale I believe this was done to avoid undoing native styling, however this decision was done before my time on RAA |
Perhaps we should assess whether we can switch to native HTML without affecting styling. |
@CalinDale to use native elements we would affect the styling (the CSS needed) in order to undo native styles, but that's all quite doable and I'm happy to go ahead with that. Would you like to dev it? We could migrate component-by-component. |
First step might be to describe the current markup, and your recommended markup. |
Current markup: <div data-accordion-component="Accordion" class="accordion">
<div
data-accordion-component="AccordionItem"
class="accordion__item"
>
<div
data-accordion-component="AccordionItemHeading"
aria-level="4"
role="heading"
class="accordion__heading"
>
<div
class="accordion__button"
aria-disabled="false"
aria-expanded="false"
aria-controls="accordion__panel-raa-1"
role="button"
tabindex="0"
data-accordion-component="AccordionItemButton"
>
ITEM NAME
</div>
</div>
<div
data-accordion-component="AccordionItemPanel"
class="accordion__panel"
id="accordion__panel-raa-1"
hidden=""
></div>
</div>
</div> Suggested markup: <div data-accordion-component="Accordion" class="accordion">
<div
data-accordion-component="AccordionItem"
class="accordion__item"
>
<h4
data-accordion-component="AccordionItemHeading"
class="accordion__heading"
>
<button
class="accordion__button"
aria-disabled="false"
aria-expanded="false"
aria-controls="accordion__panel-raa-1"
type="button"
data-accordion-component="AccordionItemButton"
>
ITEM NAME
</button>
</h4>
<div
data-accordion-component="AccordionItemPanel"
class="accordion__panel"
id="accordion__panel-raa-1"
hidden=""
></div>
</div>
</div> (The |
Currently the entire accordion is made of divs with various ARIA attributes used to replicate the functionality of native HTML
This fails the first rule of ARIA use: native html elements should be used whenever possible rather than recreating their functionality with aria attributes: https://www.w3.org/TR/using-aria/#firstrule
I don't think any of those would be impossible to implement.
The text was updated successfully, but these errors were encountered: