Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Accordion margin/padding inconsistencies #3094

Merged
merged 4 commits into from
Dec 12, 2022

Conversation

colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Dec 12, 2022

Just a quick PR to fix a few tiny Accordion issues we've had for a long time in:

  1. "Show all" button margin-bottom fix applied too wide
    Moves legacy bug fix to 'tablet' (from 'desktop') which align with font size

  2. Section button padding-bottom jumps 10px taller on mobile
    Notice how the section button height appears to get taller (unlike tablet, desktop)

  3. Trailing space in class attribute
    Now using {%- to trim whitespace as we do elsewhere

<div class="govuk-accordion__section ">

Accordion height

See original Accordion design PR

Plus a minor fix where accordion sections lack padding (during slow page loads) since:

Reducing layout shift

Whilst we know additional layout shifts take place when the accordion controls and section headers are injected, I've shifted .govuk-accordion__section-content content padding so it's applied whilst the JavaScript loads

Our Accordion sections are now open during page load, where previously we only added padding when [hidden] was added by component init() but in preparation for the --expanded modifier being toggled

Accordion section padding shown before and after component initialisation

Fixes a minor regression in:

* 879e37c

The bottom margin should be increased at tablet size (not desktop) so it matches up with the “Show all” button font size change
During a slow page load, the accordion content was briefly visible *without* padding
Copy link
Member

@querkmachine querkmachine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

I wonder if the excess button padding-bottom is a layover from the older accordion design, where the following content didn't have any top padding, which was added in #2640? Either way, makes sense to reduce it now.

@@ -79,7 +83,7 @@
cursor: pointer;
-webkit-appearance: none;

@include govuk-media-query ($from: desktop) {
@include govuk-media-query ($from: tablet) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Font sizes increase from tablet so we can add this margin sooner too

@colinrotherham
Copy link
Contributor Author

Thanks @querkmachine 🙌

@colinrotherham colinrotherham merged commit 8a9e006 into main Dec 12, 2022
@colinrotherham colinrotherham deleted the accordion-various-fixes branch December 12, 2022 15:48
@colinrotherham colinrotherham changed the title Accordion margin/padding fixes Fix Accordion margin/padding inconsistencies Dec 13, 2022
@36degrees 36degrees added this to the [NEXT] milestone Dec 15, 2022
@owenatgov owenatgov mentioned this pull request Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants