Skip to content

Header sidebar content improvements#5648

Merged
KludgeKML merged 7 commits into
mainfrom
header-sidebar-content-improvements
Jul 8, 2026
Merged

Header sidebar content improvements#5648
KludgeKML merged 7 commits into
mainfrom
header-sidebar-content-improvements

Conversation

@KludgeKML

@KludgeKML KludgeKML commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

What

Improve handling of breadcrumbs in header/sidebar/content layout.

Why

By focusing on the two things currently rendered by this layout, we can bring in incremental improvements. At the moment both of the routes handle their breadcrumbs independently. By moving breadcrumbs into the presenter and making a standard presenter variable that layouts will always have access to, we can simplify breadcrumb handling in the individual models (they just provide a breadcrumbs method, or not if they want the default Home breadcrumb), and in the layout (it can rely on a presenter with a breadcrumb method being there to determine whether or not it shows a breadcrumb, and the layout options of bottom_margin / collapse_on_mobile are defined in the layout, close to the component, rather than in a presenter somewhere), ensuring that we don't allow a proliferation of styles on this layout.

Visual changes

None, although we will have to review how about pages look when topical events with embedded about pages are tested coming out of Whitehall.

Reviewer notes:

Check:

KludgeKML added 6 commits July 7, 2026 16:16
- Allows derived classes to set @content_item_presenter to their
  subclass of ContentItemPresenter and use it in views in the
  same way content_item is.
- content_item is already added as a helper method in
  ApplicationController, so we don't need to add it here.
…m_presenter

- TopicalEvent controller now has access to the base attribute,
  so doesn't need to define it itself.
- TopicalEvent about view update to use the new variable
…senter

- Update controller to use new attribute.
- Update show page to use attribute instead of @presenter
- breadcrumbs becomes the default way to ask a
  presenter for a list of breadcrumbs. If there's nothing
  in the array, no breadcrumb components should be
  displayed.
- Because this is going to only affect header_sidebar_content
  views at the moment, it's a limited change at the moment
- We also add a default_breadcrumbs method which
  presenters can use to get the standard home.
- It is a content item presenter, because it has a content item,
  so we can get the default behaviour (including the
  breadcrumbs)
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-5648 July 7, 2026 15:29 Inactive
@KludgeKML KludgeKML force-pushed the header-sidebar-content-improvements branch from f4087f4 to e0fd39e Compare July 7, 2026 15:36
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-5648 July 7, 2026 15:36 Inactive
- Since we want everything that uses this layout to either have
  no breadcrumbs or have them with this exact margin/behaviour,
  we move the options into the layout. This is also nicer, unless
  it's saving us a lot of work we _should_ have the component
  options in the component call.
- The only things using this layout at the moment are field of
  operation and topical event about page, and they support
  the breadcrumbs method in their presenter (default or
  overridden, respectively), so we don't need to put in any
  guards about whether the presenter exists or provides
  the method.
- Now that both items are using simple breadcrumbs, we can
  drop the layout's potential call to contextual breadcrumbs,
  which was previously driving the breadcrumbs for the
  field_of_operations content items.
- We also don't copy across bottom_margin: 5 from the about
  page presenter, instead using the default. This keeps good
  current appearance on the fields-of-operation page, and
  we can worry about the embedded about pages when they
  start to be tested from Whitehall.
@KludgeKML KludgeKML force-pushed the header-sidebar-content-improvements branch from e0fd39e to 0a597a3 Compare July 7, 2026 15:51
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-5648 July 7, 2026 15:51 Inactive

@andysellick andysellick left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All looks sensible to me, but I'm not an expert. I like the idea of moving component options closer to the component in particular.

@AshGDS AshGDS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM as well!

@sairamya93 sairamya93 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me too!

@deborahchua deborahchua left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a nice solution!

@KludgeKML KludgeKML merged commit 7b7eaa3 into main Jul 8, 2026
13 checks passed
@KludgeKML KludgeKML deleted the header-sidebar-content-improvements branch July 8, 2026 10:57
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.

6 participants