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

Standardise accordion section headings font size (reduce height of section headings on mobile) #1796

Merged
merged 2 commits into from
May 19, 2020

Conversation

hannalaakso
Copy link
Member

@hannalaakso hannalaakso commented May 4, 2020

As reported in alphagov/govuk_publishing_components#1386, the height of accordion sections on mobile doesn't match GOV.UK Design System if Elements stylesheet is included. This is because of the inclusion of GOV.UK Elements which resets <h2> to inherit font-size and line-height from <body>.

We currently rely on browser defaults for font size on the accordion heading sections (although the text font size is actually set in the enclosed button and the font size in the section headings impacts only the height of the sections).

This PR sets the font size on the section headings to match our standard font sizing for <h2> elements so that we don't rely on browser defaults. However this means that the height of the accordion sections is reduced by ~9px on mobile devices.

Before After
Before change After change

Exact changes on different OS

OS / browser Before After
iOS 13 / Safari 60px 50px
iOS 12 / Safari 60px 49px
Android 10 / Chrome 58px 50px
Android 9 / Chrome 58px 50px

WCAG 2.1 states that a minimum target size must be 44 by 44 CSS pixels which this will meet.

Fixes #1789

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1796 May 4, 2020 18:26 Inactive
@hannalaakso hannalaakso force-pushed the fix-accordion-elements-bug branch from ec800cd to e397a94 Compare May 13, 2020 18:02
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1796 May 13, 2020 18:02 Inactive
@hannalaakso hannalaakso changed the title Override Elements reset on accordion <h2> height Standardise accordion section headings font size May 13, 2020
Copy link
Member

@christopherthomasdesign christopherthomasdesign left a comment

Choose a reason for hiding this comment

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

Checked out locally, looks good 👍

@hannalaakso
Copy link
Member Author

@andysellick Could you please take a look at this PR in relation to alphagov/govuk_publishing_components#1386? It standardises the heading height to be consistent with GOV.UK Frontend <h2> styles. This means that the section heading has reduced on mobile because we don't have a clear user need or an accessibility requirement to have them taller than the GOV.UK Frontend <h2> style.

@andysellick
Copy link
Contributor

@hannalaakso if this standardises things and it's still above the recommended size then that's fine.

We did have someone on our team who struggled to use the accordion at something like this size (which was also above the recommended 44x44) so maybe it's worth checking when you next have a round of user testing?

@hannalaakso
Copy link
Member Author

Thanks @andysellick. Talking IRL it sounds like this might have been more of an opinion, the user was able to complete the task. But it could be something to look out for if there's any research done. Would you be okay to leave a comment on the accordion in the backlog about this? I can also do it on your behalf.

@hannalaakso hannalaakso changed the title Standardise accordion section headings font size Standardise accordion section headings font size, reduce height of sections May 19, 2020
@hannalaakso hannalaakso changed the title Standardise accordion section headings font size, reduce height of sections Standardise accordion section headings font size (reduce height of section headings on mobile) May 19, 2020
We currently rely on browser defaults for font size on the accordion heading
sections (although the text font size is actually set in the enclosed button
 and the font size in the section headings impacts only the height of the
sections).

This PR sets the font size on the section headings to match our standard font
 sizing for `<h2>` elements so that we don't rely on browser defaults.
However this means that we the height of the accordion sections is reduced
by ~9px on mobile devices.

| OS / browser        | Before | After |
|---------------------|--------|-------|
| iOS 13 / Safari     | 60px   | 50px  |
| iOS 12 / Safari     | 60px   | 49px  |
| Android 10 / Chrome | 58px   | 50px  |
| Android 9 / Chrome  | 58px   | 50px  |

WCAG 2.1 states that a [minimum target size must be 44 by 44 CSS pixels](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html) which this will meet.
@hannalaakso hannalaakso merged commit ac66066 into master May 19, 2020
@hannalaakso hannalaakso deleted the fix-accordion-elements-bug branch May 19, 2020 15:53
@36degrees 36degrees mentioned this pull request Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Legacy code affects accordion height and touch area
5 participants