8000 Bug - Accordion does not properly support aria-controls · Issue #6866 · react-bootstrap/react-bootstrap · GitHub
[go: up one dir, main page]

Skip to content
Bug - Accordion does not properly support aria-controls #6866
Closed
@DavidSLTO

Description

@DavidSLTO

Prerequisites

Describe the bug

The aria-controls attribute helps to establish a relationship between a control (such as a button or a header) and the element it controls (such as a collapsible panel or a tab panel). Currently if aria-controls is passed to the AccordionHeader subcomponent the attribute is added to the h2 and there is no way to move this attribute to the button. (Accessible example)

Expected behavior

The AccordionHeader subcomponent should support the aria-controls property and apply it to the button instead of the h2 so that screen reader users can better understand the relationship between the AccordionHeader and the AccordionBody

To Reproduce

  1. Given a AccordionHeader and AccordionBody
  2. Add an id to the AccordionBody id='accordion-body'
  3. Add aria-controls='accordion-body' to the AccordionHeader
  4. Render the component
  5. Inspect the DOM to see that aria-controls='accordion-body' is incorrectly applied to the h2 element and not the button

Reproducible Example

https://codesandbox.io/p/sandbox/react-bootstrap-5-forked-4j5y7d?file=%2Fsrc%2FApp.js%3A19%2C18&workspaceId=6459cc5f-9c12-4ceb-9ca3-6d586cbadae4

Screenshots

No response

What operating system(s) are you seeing the problem on?

Windows

What browser(s) are you seeing the problem on?

Chrome, Firefox

What version of React-Bootstrap are you using?

2.7.2

What version of Bootstrap are you using?

5.3.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0