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

Remove taxon-list app component from collections #3844

Merged
merged 5 commits into from
Dec 17, 2024

Conversation

MartinJJones
Copy link
Contributor

@MartinJJones MartinJJones commented Nov 12, 2024

What

  • Remove the taxon-list app component
  • Update taxon_list_helper.rb to work with the document-list component
  • Replaced taxon-list app component with either the list or document-list gem components in several view templates
  • Update tests for world location and world wide taxons to check that the "title", "link" and "description" for each search result/tagged content is included on the page

Why

The taxon-list component is no longer required

The taxon-list component was originally created for an AB Test on https://www.gov.uk/education/funding-and-finance-for-students#/education/student-grants-bursaries-scholarships. This page is now using the document-list component from the govuk_publishing_components gem

Accessibility improvement

Since the document-list component doesn’t support headings for lists of links, we’ve decided not to try and add this option into the component. This is because wrapping links in headings is not a suitable option for loads of GOV.UK pages since:

  • It is technically possible for some links not to have a description (a <p> tag) after it. Having a heading or a mix of headings and plain links doesn’t seem to be a good option here as it could be confusing for users
  • Using https://www.gov.uk/world/afghanistan as an example, it currently includes 50+ heading elements (inside the accordions)
    • This seems like it would be difficult to navigate through all of the heading elements on the page, especially if some links were headings and others were not
    • We checked with an accessibility specialist to get advice on removing the heading element and agreed that this change looks like a better option as it also adds an additional layer in the accessibility tree which is likely more time consuming to navigate

Visual changes

Spacing is increased slightly for list items when using the document-list component

https://collections-pr-3844.herokuapp.com/world/afghanistan (accordion.html.erb)

Before After
accordion-before accordion-after

https://collections-pr-3844.herokuapp.com/world/living-in-afghanistan (tagged_content_list.html.erb)

Before After
Screenshot 2024-11-26 at 15 21 02 Screenshot 2024-11-26 at 15 21 10

https://collections-pr-3844.herokuapp.com/government/ministers/secretary-of-state-for-foreign-commonwealth-and-development-affairs (past_role_holders.html.erb) - No visual changes

Trello card

@govuk-ci govuk-ci temporarily deployed to collections-pr-3844 November 12, 2024 15:01 Inactive
@govuk-ci govuk-ci temporarily deployed to collections-pr-3844 November 13, 2024 16:57 Inactive
@MartinJJones MartinJJones force-pushed the remove-taxon-list-component branch from 2f2209b to b2059e5 Compare November 18, 2024 09:40
@govuk-ci govuk-ci temporarily deployed to collections-pr-3844 November 18, 2024 09:40 Inactive
@MartinJJones MartinJJones force-pushed the remove-taxon-list-component branch 6 times, most recently from de8930b to 35057dc Compare November 27, 2024 10:42
@govuk-ci govuk-ci temporarily deployed to collections-pr-3844 November 27, 2024 11:39 Inactive
@MartinJJones MartinJJones force-pushed the remove-taxon-list-component branch from 35057dc to 9832a2a Compare November 27, 2024 14:11
@govuk-ci govuk-ci temporarily deployed to collections-pr-3844 November 27, 2024 14:11 Inactive
@MartinJJones MartinJJones changed the title Remove taxon-list component Remove taxon-list app component from collections Nov 27, 2024
@MartinJJones MartinJJones force-pushed the remove-taxon-list-component branch from fe70206 to 7aa60ee Compare December 4, 2024 15:51
@MartinJJones MartinJJones reopened this Dec 4, 2024
@govuk-ci govuk-ci temporarily deployed to collections-pr-3844 December 4, 2024 16:09 Inactive
Copy link
Member

@hannalaakso hannalaakso left a comment

Choose a reason for hiding this comment

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

LGTM 🎉 Swapping these out turned out to be a bit more complicated than we initially thought and this solution resolves it all quite cleanly without the need for adding extra options to the gem which is nice. I've compared the generated HTML of the relevant templates before and after and it all looks good. The extensive commit messages were also super helpful when reviewing the changes, thanks for doing that 🙏

Remove all files relating to the taxon-list component the taxon-list component as it is no longer required.

The component was originally created for an AB Test on https://www.gov.uk/education/funding-and-finance-for-students#/education/student-grants-bursaries-scholarships

This page is now using the document-list component from the govuk_publishing_components gem
Update data structure returned from `taxon_list_params` method

Updated the structure to work with the document-list gem component, setting `full_size_description: true` ensures the font-size is set to 19px for the description when present - https://components.publishing.service.gov.uk/component-guide/document_list/with_full_size_description_text
- Use the `document-list` component from the gem instead of the `taxon-list` app component in the `tagged_content_list.html.erb` and `accordion.html.erb` view templates
- By using the document-list component, the list will change from an ordered list to an unordered list, this feels like a slight improvement as the content presented does not appear to be in order of sequence/importance
- `heading_level` variable removed from the `tagged_content_list.html.erb` template, the document-list component does not support headings and is not required here

This approach is also consistent with other places the document-list component is used, for example:

- [Education, training and skills - GOV.UK](https://www.gov.uk/education)  (collections)
- [Find contact details for services - GOV.UK](https://www.gov.uk/contact)  (feedback)
- [Travel or do business in Europe: Brexit guidance](https://www.gov.uk/government/collections/brexit-guidance) (government-frontend)
- set `disable_ga4: true` to disable GA4 tracking
  - in the accordion.html.erb this prevents duplicate events from firing as this is already built into the accordion component
  - GA4 was not enabled previously in the tagged_content_list.html.erb
Replace the `taxon-list` component with the `list` component from the govuk_publishing_components gem.

`list_type: "number"` has been used to ensure an ordered list is used to match the current HTML structure
Updated the tests to check that the "title", "link" and "description" for each search result/tagged content is included on the page
@MartinJJones MartinJJones force-pushed the remove-taxon-list-component branch from 7aa60ee to da64b05 Compare December 17, 2024 09:35
@govuk-ci govuk-ci temporarily deployed to collections-pr-3844 December 17, 2024 09:43 Inactive
@MartinJJones MartinJJones merged commit a03356a into main Dec 17, 2024
14 checks passed
@MartinJJones MartinJJones deleted the remove-taxon-list-component branch December 17, 2024 09:52
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.

3 participants