Skip to content
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

Question: Accordion Implementation vs using <details> > <summary> #2565

Closed
StfBauer opened this issue Dec 12, 2022 · 5 comments
Closed

Question: Accordion Implementation vs using <details> > <summary> #2565

StfBauer opened this issue Dec 12, 2022 · 5 comments
Labels
Pattern Page Related to a page documenting a Pattern question Issue asking a question

Comments

@StfBauer
Copy link

One question on the accordion implementation.
https://www.w3.org/WAI/ARIA/apg/example-index/accordion/accordion.html

I totally understand the implementation but why doesn't it use <details> <summary>

Would not this accomplish the same accordion just without any javascript involved and would just work with HTML only.

I wonder what the downsides are and is the shown implementation just in a way to work with old browser?

Thank you in advance.

@JAWS-test
Copy link

JAWS-test commented Jan 12, 2023

Many patterns shown here will work without ARIA. And they should be implemented in a perfect world without ARIA (https://www.w3.org/TR/using-aria/#rule1). Unfortunately, we don't live in a perfect world and many web developers don't like HTML or don't like the visual limitations of HTML (some elements can't be fully styled with CSS). That's why the patterns show ways to implement things with ARIA, but which are usually better implemented with HTML. It would make sense to mark with each example whether the respective pattern also works with HTML or not. To my knowledge, this has also been discussed here before, but unfortunately not yet implemented. But we already have the warning at the top of the page (which by the way uses <details> and <summary>):

Robust accessibility can be further optimized by choosing implementation patterns that maximize use of semantic HTML and heeding the warning that No ARIA is better than Bad ARIA.

@StfBauer
Copy link
Author

Thank you @JAWS-test - I have assumed so.

@mcking65
Copy link
Contributor

It is easy to make a disclosure with details/summary. The primary difference between the accordion and disclosure patterns is the accordion pattern includes headings. It is not possible to implement headings with details/summary.

If this, in combination with the information from JAWS-Test does not answer your question fully, please feel free to re-open the issue.

@mcking65 mcking65 added question Issue asking a question Pattern Page Related to a page documenting a Pattern labels Jan 17, 2023
@StfBauer
Copy link
Author

Thanx @mcking65

The accordion pattern includes headings.

One last question. can't I include headings in the summary?

@JAWS-test
Copy link

can't I include headings in the summary?

According to the HTML specification, just about anything can be in a summary: Headings, links, videos etc.
But: Many browsers treat the summary element like a button (which makes sense in itself) and a button has implicit role=presentation for all children, which means that all child elements have no role. If a heading or link has no role, its semantics will not be output by the screen reader. In practice, some screen readers output the roles anyway, others do not. Thus, a summary should currently contain only text and nothing else.

See: w3c/html-aam#345 and FreedomScientific/standards-support#591

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pattern Page Related to a page documenting a Pattern question Issue asking a question
Projects
None yet
Development

No branches or pull requests

3 participants