Skip to content

Commit

Permalink
Merge pull request #483 from UN-OCHA/CD-554
Browse files Browse the repository at this point in the history
[CD-554] default styles for field_group details/summary elements
  • Loading branch information
rupl authored May 15, 2024
2 parents 82212b8 + 6947971 commit b16a2bf
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions libraries/cd-form/cd-form.css
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,40 @@ form .form-type-checkbox > .cd-form__description {
form .fieldset-wrapper > .form-type-checkbox + .form-type-checkbox {
margin-top: 1rem;
}

/**
* Enhancements to widgets from field_group module
*/

form .field-group-details {
margin-block-start: 1rem;
padding-inline: 1rem;
border-radius: 5px;
background: var(--brand-grey);
}

form .field-group-details[open] {
padding-block: 1rem;
}

/* <summary> needs to cancel padding on <details> when open */
form .field-group-details[open] summary {
margin-block-start: -1rem;
}

/* normalize.css removes built-in browser affordance for <summary> so we are
resetting its display */
form .field-group-details summary {
display: list-item;
cursor: pointer;
border-radius: 5px;
margin-inline: -1rem; /* cancel padding on <details> */
padding-block: .25rem;
padding-inline: 1rem;
font-weight: 700;
}

form .field-group-details summary:focus-visible {
outline: 3px solid var(--cd-black);
}

0 comments on commit b16a2bf

Please sign in to comment.