question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accordion semantic variance and accessbility loss

See original GitHub issue

Hello, and thanks for taking the effort in porting bootstrap components to Angular 2.

My concern is on losing html semantic and aria roles in the process. As an example the accordion component :

In bootstrap 4 we have :

<div id="accordion" role="tablist" aria-multiselectable="true">
  <div class="card">
    <div class="card-header" role="tab" id="headingOne">
      <h5 class="mb-0">
        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Collapsible Group Item #1
        </a>
      </h5>
    </div>

    <div id="collapseOne" class="collapse in" role="tabpanel" aria-labelledby="headingOne">
      <div class="card-block">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
<div class="card">
    <div class="card-header" role="tab" id="headingTwo">
      <h5 class="mb-0">
        <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
        </a>
      </h5>
    </div>
    <div id="collapseTwo" class="collapse" role="tabpanel" aria-labelledby="headingTwo">
      <div class="card-block">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
</div>

Each panel group (title + content) is wrapped in a single card element. Aria roles are set accordingly (tablist, tab, aria-labelledby, …)

Whereas with ng-bootstrap rendred accordion component we get something like this :

<ngb-accordion activeids="ngb-panel-0" ng-reflect-active-ids="ngb-panel-0">
  <div class="card">
      <div ng-reflect-class-name="card-header " class="card-header active">
        <a href="">Simple</a>
      </div>
      <div class="card-block">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia
        aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor,
        sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
        craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings
        occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus
        labore sustainable VHS.
     </div>
      <div ng-reflect-class-name="card-header " class="card-header ">
        <a href="">
          <span>★ <b>Fancy</b> title ★</span>
        </a>
      </div>
      <div ng-reflect-class-name="card-header " class="card-header ">
        <a href="" class="text-muted">Disabled</a>
      </div>
  </div>
</ngb-accordion>

Aria roles are gone and all panel titles and content are wrapped in the same card element.

I don’t understand the choice of dropping accessibility since it’s already here and working in bootstrap 4, and html semantic divergence can be confusing and lead to presentation bug (custom styling).

Link to minimally-working plunker that reproduces the issue:

Bootstrap accordion example can be found here

ng-bootstrap accordion can be found here

Version of Angular, ng-bootstrap, and Bootstrap:

Angular: 2.1.0

ng-bootstrap: 1.0.0-alpha.13

Bootstrap: v4.0.0-alpha.5

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pkozlowski-opensourcecommented, Nov 21, 2016

@ygatesoupe I’ve sent PR #1070 to address accessibility-related attributes. Would be great if you could review this one.

We still got a bit of discrepancy between Bootstrap’s proposed markup and the markup we are producing:

  • BS 4 is using a separate card for each panel while we have just one card. For now I’m going to leave it as-is since I think that our look & feel is better. I will follow up with the Bootstrap team and eventually change things in this project.
  • BS 4 is using <h5> around header links - we should probably add it as well.
  • BS 4 is adding a wrapper div around card-block and frankly I don’t see why this one is needed. I will follow up with the Bootstrap team and eventually change things in this project.
1reaction
pkozlowski-opensourcecommented, Nov 16, 2016

I don’t understand the choice of dropping accessibility since it’s already here and working in bootstrap 4, and html semantic divergence can be confusing and lead to presentation bug (custom styling).

We are not “choosing to drop accessibility”, far from it! It is just that we didn’t get to complete accessibility review and fixes yet. Our thinking was / is that we want to stabilise the public APIs first and when its done add things like animations, accessibility and keyboard support (in other words all features than will make widgets solid but don’t require breaking API changes).

So once again, it is not like we don’t care about accessibility nor that we are not working on it deliberately. It is just that we’ve prioritized public APIs over other enhancements. If you want us to get there faster a PR fixing things you’ve noticed would be helpful.

Also please note that we didn’t “remove” anythings: cards were not present in Bootstrap 3 / angular-ui/bootstrap and Bootstrap 4 added example of an accordion based on cards only very recently (after we did initial implementation of the accordion).

In short: accessibility is important for us and is part of the roadmap. Helping with PRs would be appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accordions | Accessibility Guidelines
Accordions. Accordions are common design structures used to organize and hide content, so as not to overwhelm the user. Accordions are also web...
Read more >
A Common Mechanism in Verb and Noun Naming Deficits in ...
Our results support feature-based, semantic representations for nouns and verbs and support the role of inter-correlated features in noun ...
Read more >
Making Content Usable for People with Cognitive and ... - W3C
This document is for people who make web content (web pages) and web applications. It gives advice on how to make content usable...
Read more >
What Influences The Accessibility Of Conceptual Knowledge ...
Previous studies have shown that accessibility of conceptual information declines when sets of semantically-related items are presented repeatedly, ...
Read more >
Semantic-UI Accordion Inverted Variation - GeeksforGeeks
Semantic UI Accordion Inverted Variation: If you want to display accordion on black background you can make use of an inverted accordion.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found