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

[RW-826][CD-530] Reduce CLS in Global Header #458

Merged
merged 2 commits into from
Jan 16, 2024
Merged

[RW-826][CD-530] Reduce CLS in Global Header #458

merged 2 commits into from
Jan 16, 2024

Conversation

rupl
Copy link
Contributor

@rupl rupl commented Jan 16, 2024

RW-826 / CD-530

Types of changes

  • Improvement (non-breaking change which iterates on an existing feature)
  • ✔️ Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Security update (dependency updates, or to fix a vulnerability)

Description

Improves the Cumulative Layout Shift (CLS), a Core Web Vital that is very important to Google and its search results.

Steps to reproduce the problem or Steps to test

  1. Load branch and stuff.
  2. Using the devtools of your choice, do the following:
    • Disable caching, or start with a private browsing window
    • Throttle the network to something slow (so that you can see the effect)
  3. Load the page and observe that the Help/User menus consistently render to the right of the Global Header (in LTR). They should NEVER appear on the left, even momentarily.

Example video:

RW-826-demo.mov

Impact

If the cd-global-header.html.twig file is overridden in the sub-theme, it will need to have the new line of HTML inserted, or the OCHA Services menu will never display.

@left23 if you could double-check this aspect that would be most helpful. I reviewed all the base-theme and sub-theme templates and believe I got the impact instructions correct. But your confirmation would be most helpful. If you agree, go ahead and tick the last checkbox in the checklist.

PR Checklist

  • I have followed the Conventional Commits guidelines.
  • I have made changes to the sub theme to reflect those in the base theme

rupl added 2 commits January 16, 2024 09:18
By adding a container element for OCHA Services, the Global Header
layout can remain more stable, and no longer depends on the JS
executing in order to render the final expected layout.

Refs: RW-826, CD-530
@rupl rupl requested a review from left23 January 16, 2024 09:50
Copy link
Contributor

@left23 left23 left a comment

Choose a reason for hiding this comment

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

This looks good! I tested locally on RW and I think the steps are accurate.
Most sites will have a cd-global-header.html.twig override file. From what I can see, all include an extend from @common_design/cd/cd-header/cd-global-header.html.twig so no negative impact expected. https://github.com/search?q=org%3AUN-OCHA%20cd-global-header.html.twig&type=code

@rupl
Copy link
Contributor Author

rupl commented Jan 16, 2024

That was my thinking as well with the extend sub-theme template. Great, then the instructions are accurate. Thanks for the 👀

@rupl rupl merged commit d089b67 into develop Jan 16, 2024
1 check passed
@rupl rupl deleted the RW-826 branch January 16, 2024 12:50
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.

2 participants