goetzrobin / spartan

Cutting-edge tools powering Angular full-stack development.
https://spartan.ng
MIT License
1.36k stars 144 forks source link

accordion-content is focusable even when hlmAccordionItem is closed #175

Closed azan-n closed 7 months ago

azan-n commented 7 months ago

Please provide the environment you discovered this bug in.

    "@angular/animations": "17.0.7",
    "@angular/cdk": "17.0.4",
    "@angular/common": "17.0.7",
    "@angular/compiler": "17.0.7",
    "@angular/core": "17.0.7",
    "@spartan-ng/ui-accordion-brain": "0.0.1-alpha.335",
    "@spartan-ng/ui-core": "^0.0.1-alpha.335",
<div hlmAccordion>
@for (baseRoute of routes;) {
<div hlmAccordionItem>
    <button hlmAccordionTrigger>
          {{ baseRoute.label }}
          <hlm-icon hlmAccIcon />
    </button>
    <brn-accordion-content hlm>
    @for (child of baseRoute.children;){
       <button>When should I be focused on by the keyboard?</button>
    }
    </brn-accordion-content>
</div>
}
</div>

Which area/package is the issue in?

accordion

Description

I might be wrong here but with most of the ARIA-compliant accordions I have worked with, the accordion content is not keyboard-focusable if the accordion is closed. However, that is not the case with spartan. It should be doable with tabindex, or aria-hidden but I would have to research this more before submitting a PR.

Please provide the exception or error you saw

No response

Other information

No response

I would be willing to submit a PR to fix this issue