diff --git a/.changeset/fix-nested-accordion-icon-state.md b/.changeset/fix-nested-accordion-icon-state.md new file mode 100644 index 0000000000..56ef097163 --- /dev/null +++ b/.changeset/fix-nested-accordion-icon-state.md @@ -0,0 +1,7 @@ +--- +'@backstage/ui': patch +--- + +Fixed nested Accordion icon state issue where the inner accordion's arrow icon would incorrectly show as expanded when only the outer accordion was expanded. The CSS selector now uses a direct parent selector to ensure the icon only responds to its own accordion's expanded state. + +Affected components: Accordion diff --git a/packages/ui/src/components/Accordion/Accordion.module.css b/packages/ui/src/components/Accordion/Accordion.module.css index a86400986d..357696b0ff 100644 --- a/packages/ui/src/components/Accordion/Accordion.module.css +++ b/packages/ui/src/components/Accordion/Accordion.module.css @@ -73,13 +73,13 @@ width: 1rem; height: 1rem; - [data-expanded='true'] & { + .bui-Accordion[data-expanded='true'] > .bui-AccordionTrigger & { transform: rotate(180deg); } } .bui-AccordionPanel { - [data-expanded='true'] & { + .bui-Accordion[data-expanded='true'] > & { padding-top: var(--bui-space-1); } }