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

Update design of accordion component #1884

Merged
merged 4 commits into from
Feb 9, 2021
Merged

Conversation

chris-gds
Copy link
Contributor

@chris-gds chris-gds commented Jan 20, 2021

What?

Porting the Design System's Accordion component into the gem and updating the Design to improve a11y and usability.

Why?

GOV.UK currently uses 3 different accordions on different parts of the site. Some of them are not as accessible as they could be and they are not consistent in the way they open and close (the language they use). This is a fail of WCAG SC 3.2.4.
This update is part of on-going work to improve and create a consistent design that might eventually feed into the Design System depending on further research / outcome of performance. (Ticket)

Visual Changes

Before (left) After (right)

Screenshot 2021-02-08 at 09 54 33

Screenshot 2021-01-28 at 19 10 41

Interactions demo

design-updates-accordion

Assistive Technology Testing

Testing Videos, Notes & Discussion
Screen.Recording.2021-02-08.at.09.41.42.mov

(user adjusts colour reference videos)
https://user-images.githubusercontent.com/71266765/106749352-52d9f580-661e-11eb-85fc-1f78fb368f8e.mov

Screen.Recording.2021-02-03.at.09.22.26.mov
Screen.Recording.2021-02-03.at.09.18.04.mov
high-contrast-greyscale-mode.mov
inverted.mov

IE11
image

  • The heading reads the "Show / Hide this section" copy that is potentially redundant or confusing information to the user. This ties into comments from the original Accordion below:

The ‘Open all’ button reads out as ‘Open all sections’ for screen readers. This is potentially confusing for users as the visual content is different to what screen readers read out.

After discussion with team it was noted that this was based on the tested step-by-step and while not perfect is not an WCAG fail.

  • The change in focus states was queried if this would impact WCAG 3.2.4 as it's not consistent with other elements.

The team decided this was not a WCAG concern.

300% zoom

Screenshot 2021-02-04 at 14 21 08

Possible Improvements

  • The Chevron could offer a visual cue on hover (after team discussion it was decided the current the affordance is fine)

  • Once the Accordion is opened, some work was done to auto-focus the inner Content once expanded for AT, I removed it as part of this PR as out of scope.

  • Buttons receiving the “hand cursor” has been noted as not strictly best practice. Needs discussion.

Anything else

  • PR was raised as Draft as on-going Design iterations were on-going in parallel

  • Closed PR on collections to ensure Design updates cascade through to uses on other repos.


@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 20, 2021 19:50 Inactive
@chris-gds chris-gds marked this pull request as draft January 20, 2021 19:50
@chris-gds chris-gds force-pushed the accordion-design-update branch from ecf0427 to 99106df Compare January 21, 2021 09:38
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 21, 2021 09:38 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 21, 2021 09:44 Inactive
@chris-gds chris-gds force-pushed the accordion-design-update branch from da452b3 to 93f4b6b Compare January 21, 2021 10:20
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 21, 2021 10:20 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 21, 2021 15:48 Inactive
@chris-gds chris-gds force-pushed the accordion-design-update branch from 334bc15 to 21feaf8 Compare January 22, 2021 10:13
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 22, 2021 10:13 Inactive
@chris-gds chris-gds force-pushed the accordion-design-update branch from 21feaf8 to 472173e Compare January 25, 2021 09:10
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 25, 2021 09:11 Inactive
@chris-gds chris-gds force-pushed the accordion-design-update branch from 472173e to ad8fbc2 Compare January 25, 2021 10:06
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 25, 2021 10:06 Inactive
@chris-gds chris-gds force-pushed the accordion-design-update branch from ad8fbc2 to b6def75 Compare January 25, 2021 10:08
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 25, 2021 10:08 Inactive
@chris-gds chris-gds marked this pull request as ready for review January 25, 2021 11:29
@chris-gds chris-gds marked this pull request as draft January 25, 2021 14:40
Copy link
Contributor

@owenatgov owenatgov left a comment

Choose a reason for hiding this comment

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

Couple of comments for the draft, looking good so far!

Few extra bits of feedback:

  • You've included the js for the design system accordion but not the test. Could we add this in please?
  • My step by step design updates are imminent and this should be applied to the accordion. I think this just translates to extra spacing and reduced border widths. I'm aware you're working with Mia on this 👍

@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 27, 2021 09:41 Inactive
@chris-gds chris-gds force-pushed the accordion-design-update branch from 38102c8 to a3c1582 Compare January 27, 2021 09:47
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 27, 2021 09:47 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji January 27, 2021 09:50 Inactive
@injms
Copy link
Contributor

injms commented Jan 28, 2021

A couple of visual things:

  • when focused and hovered, the heading text appears to be purple/dark blue instead of black whilst the show/hide text is black; I think that the heading text should be black for the best contrast.

  • the yellow background takes up all the space, but the screenshots on the pull request description show yellow only taking a portion of the accordion. Which is correct? My worry with the clickable area being so big is that the blank space on the right gives no indication that it's a link and is far enough away from a link to not be thought of as interactive.

  • the grey border is still present during the focus state, sandwiched between the yellow and the black. I think that this should be removed when focused.

Screenshot 2021-01-28 at 11 15 56

When hovering over the accordions section the heading text changes colour to a dark blue and the show/hide text doesn't; should both change colour together?

Screenshot 2021-01-28 at 11 24 52

@chris-gds
Copy link
Contributor Author

chris-gds commented Jan 28, 2021

A couple of visual things:

+1 to all of these, the Design has been updated since this was initially raised so will all be addressed.

@chris-gds chris-gds force-pushed the accordion-design-update branch from 9c94946 to e5a807f Compare February 8, 2021 10:03
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji February 8, 2021 10:03 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji February 8, 2021 17:37 Inactive
Copy link
Contributor

@owenatgov owenatgov left a comment

Choose a reason for hiding this comment

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

I'm a big fan of the last couple of changes you've made, very nice. I reckon you could squash your commits together a bit before merging though. Also maybe wait to merge or check in govuk frontenders as I know @alex-ju is putting out a breaking release today and as this is quite delicate we may want to wait a bit.

Once this is out I'd like to confer on differences between this and the step by step and see if we can bring in some of your technical choices eg: the css chevron, possibly moving towards bringing these close together, as is the dream.

Farewell accordion country 😃

}

// Reduce Chevron size
.gem-c-accordion-nav__chevron {
Copy link
Contributor

Choose a reason for hiding this comment

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

I love this!!

@chris-gds
Copy link
Contributor Author

Thanks @owenatgov

squash your commits together a bit before merging though.

Will do, I thought to myself the differences might be a bit easier to review this way to start - then the squash™

I know @alex-ju is putting out a breaking release today and as this is quite delicate we may want to wait a bit.

Ah OK, will do - i'll ping and hold off for the moment.

Once this is out I'd like to confer on differences between this and the step by step and see if we can bring in some of your technical choices eg: the css chevron, possibly moving towards bringing these close together, as is the dream.

Yup this works, whoop, leaving Accordion country, now boarding 😃

@chris-gds chris-gds force-pushed the accordion-design-update branch from 8407e30 to de92f81 Compare February 9, 2021 13:46
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji February 9, 2021 13:47 Inactive
Chris Yoong added 4 commits February 9, 2021 13:59
Porting from Design system, adjusting format of JS for gem, integrate missing polfill. Adding additional styling and adjustments to markup to alter Design.

Defining nodeListForEach only used within accordion, restore naming conventions
Converting accordion to gem version, updating new Design within inline Chervon SVG icon, isolating with gem as much as possible
Visual structure changed to header > (summary copy) > button, adjusting JS for new layout. 

Add CSS icon, moving icon to right, place the toggle links in a wrapper so the chevron icon doesn't jump (left / right ) due to text width when toggled. 

Updating spacing, hover styles, add focus state on wider parent element. 

Alter labelling so "hide this section" is not read by AT a second time when referencing inner Content yet maintaining relationship between the header and the inner Content.

Change gem naming more inline with current conventions. Updating docs, explaining what experimental means for context
More accurate a11y AC but not fully comprehensive. 

Update CHANGELOG.md
@chris-gds chris-gds force-pushed the accordion-design-update branch from de92f81 to 6d4da1e Compare February 9, 2021 14:02
@bevanloon bevanloon temporarily deployed to govuk-publis-accordion--mmk9ji February 9, 2021 14:02 Inactive
@chris-gds chris-gds merged commit e85b465 into master Feb 9, 2021
@chris-gds chris-gds deleted the accordion-design-update branch February 9, 2021 14:05
@danacotoran danacotoran mentioned this pull request Feb 10, 2021
chris-gds pushed a commit to alphagov/govuk-frontend that referenced this pull request Aug 9, 2021
- Using "govuk-em"
- Remove explicitly defined colour as inherited.  

Many users alter their browser settings -  a user might zoom in or increase the size of the font to adjust a webpage for their needs.

In order to more closely meet Accessibility Acceptable Criteria of "zoom-text-only 300%"[1] the icon within the Accordion has been adjusted to use relative[2] values utilising an existing mixin[5]

This allows the icon to scale correctly as zoom via "text only" is being used.  As it's a relative value (not a pixel) this is more inline with Responsive Design[3] principles and also more closely aligns with WCAG 1.4.4[4] and previous iteration[6]
---

[1] https://support.mozilla.org/en-US/kb/font-size-and-zoom-increase-size-of-web-pages#w_how-to-only-change-the-size-of-the-text

[2] https://thecssworkshop.com/lessons/relative-units

[3] https://alistapart.com/article/responsive-web-design/

[4] https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html

[5] https://github.com/alphagov/govuk-frontend/blob/2f96f0d2cf088058d2beac7112167605c815b4df/src/govuk/tools/_px-to-em.scss#L12

[6] alphagov/govuk_publishing_components#1884

---
Non exhausted examples of how to test this:

Within FireFox: 
View > Zoom > Zoom text only
Within Chrome
https://support.google.com/chrome/answer/96810?hl=en
chris-gds pushed a commit to alphagov/govuk-frontend that referenced this pull request Aug 9, 2021
- Using "govuk-em"
- Remove explicitly defined colour as inherited.  

Many users alter their browser settings -  a user might zoom in or increase the size of the font to adjust a webpage for their needs.

In order to more closely meet Accessibility Acceptable Criteria of "zoom-text-only 300%"[1] the icon within the Accordion has been adjusted to use relative[2] values utilising an existing mixin[5]

This allows the icon to scale correctly as zoom via "text only" is being used.  As it's a relative value (not a pixel) this is more inline with Responsive Design[3] principles and also more closely aligns with WCAG 1.4.4[4] and previous iteration[6]
---

[1] https://support.mozilla.org/en-US/kb/font-size-and-zoom-increase-size-of-web-pages#w_how-to-only-change-the-size-of-the-text

[2] https://thecssworkshop.com/lessons/relative-units

[3] https://alistapart.com/article/responsive-web-design/

[4] https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html

[5] https://github.com/alphagov/govuk-frontend/blob/2f96f0d2cf088058d2beac7112167605c815b4df/src/govuk/tools/_px-to-em.scss#L12

[6] alphagov/govuk_publishing_components#1884

---
Non exhausted examples of how to test this:

Within FireFox: 
View > Zoom > Zoom text only
Within Chrome
https://support.google.com/chrome/answer/96810?hl=en
chris-gds pushed a commit to alphagov/govuk-frontend that referenced this pull request Aug 9, 2021
- Using "govuk-em"
- Remove explicitly defined colour as inherited.  

Many users alter their browser settings -  a user might zoom in or increase the size of the font to adjust a webpage for their needs.

In order to more closely meet Accessibility Acceptable Criteria of "zoom-text-only 300%"[1] the icon within the Accordion has been adjusted to use relative[2] values utilising an existing mixin[5]

This allows the icon to scale correctly as zoom via "text only" is being used.  As it's a relative value (not a pixel) this is more inline with Responsive Design[3] principles and also more closely aligns with WCAG 1.4.4[4] and previous iteration[6]
---

[1] https://support.mozilla.org/en-US/kb/font-size-and-zoom-increase-size-of-web-pages#w_how-to-only-change-the-size-of-the-text

[2] https://thecssworkshop.com/lessons/relative-units

[3] https://alistapart.com/article/responsive-web-design/

[4] https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html

[5] https://github.com/alphagov/govuk-frontend/blob/2f96f0d2cf088058d2beac7112167605c815b4df/src/govuk/tools/_px-to-em.scss#L12

[6] alphagov/govuk_publishing_components#1884

---
Non exhausted examples of how to test this:

Within FireFox: 
View > Zoom > Zoom text only
Within Chrome
https://support.google.com/chrome/answer/96810?hl=en
chris-gds pushed a commit to alphagov/govuk-frontend that referenced this pull request Aug 10, 2021
- Using "govuk-em"
- Remove explicitly defined colour as inherited.  

Many users alter their browser settings -  a user might zoom in or increase the size of the font to adjust a webpage for their needs.

In order to more closely meet Accessibility Acceptable Criteria of "zoom-text-only 300%"[1] the icon within the Accordion has been adjusted to use relative[2] values utilising an existing mixin[5]

This allows the icon to scale correctly as zoom via "text only" is being used.  As it's a relative value (not a pixel) this is more inline with Responsive Design[3] principles and also more closely aligns with WCAG 1.4.4[4] and previous iteration[6]
---

[1] https://support.mozilla.org/en-US/kb/font-size-and-zoom-increase-size-of-web-pages#w_how-to-only-change-the-size-of-the-text

[2] https://thecssworkshop.com/lessons/relative-units

[3] https://alistapart.com/article/responsive-web-design/

[4] https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html

[5] https://github.com/alphagov/govuk-frontend/blob/2f96f0d2cf088058d2beac7112167605c815b4df/src/govuk/tools/_px-to-em.scss#L12

[6] alphagov/govuk_publishing_components#1884

---
Non exhausted examples of how to test this:

Within FireFox: 
View > Zoom > Zoom text only
Within Chrome
https://support.google.com/chrome/answer/96810?hl=en
chris-gds pushed a commit to alphagov/govuk-frontend that referenced this pull request Aug 10, 2021
- Using "govuk-em"
- Remove explicitly defined colour as inherited.  

Many users alter their browser settings -  a user might zoom in or increase the size of the font to adjust a webpage for their needs.

In order to more closely meet Accessibility Acceptable Criteria of "zoom-text-only 300%"[1] the icon within the Accordion has been adjusted to use relative[2] values utilising an existing mixin[5]

This allows the icon to scale correctly as zoom via "text only" is being used.  As it's a relative value (not a pixel) this is more inline with Responsive Design[3] principles and also more closely aligns with WCAG 1.4.4[4] and previous iteration[6]
---

[1] https://support.mozilla.org/en-US/kb/font-size-and-zoom-increase-size-of-web-pages#w_how-to-only-change-the-size-of-the-text

[2] https://thecssworkshop.com/lessons/relative-units

[3] https://alistapart.com/article/responsive-web-design/

[4] https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html

[5] https://github.com/alphagov/govuk-frontend/blob/2f96f0d2cf088058d2beac7112167605c815b4df/src/govuk/tools/_px-to-em.scss#L12

[6] alphagov/govuk_publishing_components#1884

---
Non exhausted examples of how to test this:

Within FireFox: 
View > Zoom > Zoom text only
Within Chrome
https://support.google.com/chrome/answer/96810?hl=en
hannalaakso pushed a commit to alphagov/govuk-frontend that referenced this pull request Aug 24, 2021
- Using "govuk-em"
- Remove explicitly defined colour as inherited.  

Many users alter their browser settings -  a user might zoom in or increase the size of the font to adjust a webpage for their needs.

In order to more closely meet Accessibility Acceptable Criteria of "zoom-text-only 300%"[1] the icon within the Accordion has been adjusted to use relative[2] values utilising an existing mixin[5]

This allows the icon to scale correctly as zoom via "text only" is being used.  As it's a relative value (not a pixel) this is more inline with Responsive Design[3] principles and also more closely aligns with WCAG 1.4.4[4] and previous iteration[6]
---

[1] https://support.mozilla.org/en-US/kb/font-size-and-zoom-increase-size-of-web-pages#w_how-to-only-change-the-size-of-the-text

[2] https://thecssworkshop.com/lessons/relative-units

[3] https://alistapart.com/article/responsive-web-design/

[4] https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html

[5] https://github.com/alphagov/govuk-frontend/blob/2f96f0d2cf088058d2beac7112167605c815b4df/src/govuk/tools/_px-to-em.scss#L12

[6] alphagov/govuk_publishing_components#1884

---
Non exhausted examples of how to test this:

Within FireFox: 
View > Zoom > Zoom text only
Within Chrome
https://support.google.com/chrome/answer/96810?hl=en
vanitabarrett pushed a commit to alphagov/govuk-frontend that referenced this pull request Sep 22, 2021
- Using "govuk-em"
- Remove explicitly defined colour as inherited.  

Many users alter their browser settings -  a user might zoom in or increase the size of the font to adjust a webpage for their needs.

In order to more closely meet Accessibility Acceptable Criteria of "zoom-text-only 300%"[1] the icon within the Accordion has been adjusted to use relative[2] values utilising an existing mixin[5]

This allows the icon to scale correctly as zoom via "text only" is being used.  As it's a relative value (not a pixel) this is more inline with Responsive Design[3] principles and also more closely aligns with WCAG 1.4.4[4] and previous iteration[6]
---

[1] https://support.mozilla.org/en-US/kb/font-size-and-zoom-increase-size-of-web-pages#w_how-to-only-change-the-size-of-the-text

[2] https://thecssworkshop.com/lessons/relative-units

[3] https://alistapart.com/article/responsive-web-design/

[4] https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html

[5] https://github.com/alphagov/govuk-frontend/blob/2f96f0d2cf088058d2beac7112167605c815b4df/src/govuk/tools/_px-to-em.scss#L12

[6] alphagov/govuk_publishing_components#1884

---
Non exhausted examples of how to test this:

Within FireFox: 
View > Zoom > Zoom text only
Within Chrome
https://support.google.com/chrome/answer/96810?hl=en
hannalaakso pushed a commit to alphagov/govuk-frontend that referenced this pull request Nov 1, 2021
- Using "govuk-em"
- Remove explicitly defined colour as inherited.  

Many users alter their browser settings -  a user might zoom in or increase the size of the font to adjust a webpage for their needs.

In order to more closely meet Accessibility Acceptable Criteria of "zoom-text-only 300%"[1] the icon within the Accordion has been adjusted to use relative[2] values utilising an existing mixin[5]

This allows the icon to scale correctly as zoom via "text only" is being used.  As it's a relative value (not a pixel) this is more inline with Responsive Design[3] principles and also more closely aligns with WCAG 1.4.4[4] and previous iteration[6]
---

[1] https://support.mozilla.org/en-US/kb/font-size-and-zoom-increase-size-of-web-pages#w_how-to-only-change-the-size-of-the-text

[2] https://thecssworkshop.com/lessons/relative-units

[3] https://alistapart.com/article/responsive-web-design/

[4] https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-scale.html

[5] https://github.com/alphagov/govuk-frontend/blob/2f96f0d2cf088058d2beac7112167605c815b4df/src/govuk/tools/_px-to-em.scss#L12

[6] alphagov/govuk_publishing_components#1884

---
Non exhausted examples of how to test this:

Within FireFox: 
View > Zoom > Zoom text only
Within Chrome
https://support.google.com/chrome/answer/96810?hl=en
chris-gds pushed a commit that referenced this pull request Jan 24, 2022
chris-gds pushed a commit that referenced this pull request Jan 24, 2022
This reverts commit e85b465.

Reverting previous work completed on the Accoridon that diverged from the Design System
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.

5 participants