Problem/Motivation
Since #3337643: Apply B5 accordion styles to HTML element details, templates/form/details.html.twig renders a details element as a Bootstrap accordion item, with both accordion-header and accordion-button on the <summary>. Bootstrap rounds the button's top corners only through .accordion-item:first-of-type > .accordion-header .accordion-button, which expects the button inside the header, so it never matches: the summary keeps border-radius: 0 at the top.
As scss/drupal/_details.scss sets overflow: unset on the details, the summary's square background is painted over the item's rounded top border. On a collapsed details (white summary on a white page), the top corners of the frame look cut off; on an open one, the light blue summary pokes past the curve. The bottom corners of a collapsed details are fine, since _details.scss already rounds them.
Steps to reproduce
- Use Bootstrap 5 (or a subtheme) as the front-end theme.
- Display any form with a details element, collapsed and open.
- Zoom on the top corners: the summary's computed
border-radiusis0at the top while thedetails.accordion-itemhas0.375rem.
Proposed resolution
Round the summary's top corners in scss/drupal/_details.scss, for example:
.accordion { details > .accordion-button { @include border-top-radius(var(--#{$prefix}accordion-inner-border-radius)); } }
The same rule as plain CSS, applied in a subtheme, fixes it on a site using 4.0.9.
Remaining tasks
- MR with the SCSS change and the rebuilt CSS.
User interface changes
Details elements get rounded top corners matching their frame.
API changes
None.
Data model changes
None.
AI-Generated: Yes (Claude Code was used to find the cause and draft this issue. I reviewed it and checked the fix on a local site.)
Issue fork bootstrap5-3640422
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mably commentedThe MR is ready for review: https://git.drupalcode.org/project/bootstrap5/-/merge_requests/120
Its pipeline fails on cspell, phpstan and stylelint, but those three jobs already fail on 5.0.x at the commit the branch starts from. None of the reported lines is in the files this MR changes: cspell only flags "colour" in
bootstrap5.themeandsrc/SettingsManager.php, and "bootswatch" in the README.AI-Generated: Yes (Claude Code was used to check the pipeline and draft this comment. I reviewed it.)