Skip to content

Use consistent line heights (nav, footer, CTAs, content) in old&new pages#15790

Closed
janbrasna wants to merge 3 commits intomozilla:mainfrom
janbrasna:fix/header-height
Closed

Use consistent line heights (nav, footer, CTAs, content) in old&new pages#15790
janbrasna wants to merge 3 commits intomozilla:mainfrom
janbrasna:fix/header-height

Conversation

@janbrasna
Copy link
Collaborator

@janbrasna janbrasna commented Dec 24, 2024

Note

Waiting for Protocol v20 to apply new typography site-wide, to see how much it resolves itself. 🚧

One-line summary

Applies refresh metrics to all the content, no matter if m24-base or non-m24-base.

Significant changes and points to review

Refreshed pages have different defaults affecting also nav elements, making shifts in layout visible when navigating to older pages. This sets the base var explicitly to the header components to not inherit any other value.

Both the desktop and mobile nav inconsistencies caused by differing line-height as captured in the tracking issue are resolved here by using the "taller" version as that seems to be better aligned in general. EDIT: Nav uses yet another line height that defines the menu element height.

Issue / Bugzilla link

Fixes #15788
Fixes #15803

Testing

/about/ ⇄ /products/
(+ /firefox/ for submenu impact)

@janbrasna janbrasna requested a review from a team as a code owner December 24, 2024 00:45
@codecov
Copy link

codecov bot commented Dec 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.10%. Comparing base (c8ac92f) to head (cb56f30).
Report is 263 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15790      +/-   ##
==========================================
+ Coverage   79.07%   79.10%   +0.02%     
==========================================
  Files         160      160              
  Lines        8359     8312      -47     
==========================================
- Hits         6610     6575      -35     
+ Misses       1749     1737      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

background-color: $color-white;
border-bottom: $border-width solid $m24-color-light-mid-gray;
display: flex;
line-height: var(--body-line-height);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmh now with #15803 also affecting footer, and the letterspacing mentioned there too, I'm starting to think whether instead of adding more and more explicit line-height and letter-spacing values around here for specificity a better approach would be to only apply all of the generic m24-base styles specifically to something like #outer-wrapper > main scope, not to interfere with header and footer…?

@stephaniehobson stephaniehobson added Needs Review Awaiting code review Frontend HTML, CSS, JS... client side stuff labels Jan 6, 2025
@wen-2018 wen-2018 self-assigned this Jan 7, 2025
@wen-2018 wen-2018 removed the Needs Review Awaiting code review label Jan 7, 2025
@janbrasna
Copy link
Collaborator Author

Since I'm not sure which is closer to the original Figma/brief, the tighter line-height or the looser occurrence from the two in #15803 (comment) I'm not sure which one to effectively use to unify these, if I were to include resolving footer along with the header already in this PR.

Optically the 1.2 looks more harmonic for footer list items. However the original design seemed to prefer the 1.4 for consistency(?)

Currently I think the approach here redefining the components again for specificity is not the right one, and instead only applying the m24-base styles for refreshed pages to the main content might make more sense, but will have bigger change surface to test properly for any unexpected effects (as it also changes specificity when moved around…)

@janbrasna
Copy link
Collaborator Author

(To demonstrate the above, an alternative approach PoC: janbrasna@476d436 that feels more "correct", but will need carefully comparing any unexpected impact…)

Copy link
Collaborator

@wen-2018 wen-2018 left a comment

Choose a reason for hiding this comment

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

I have looked the Figma files. For the new designs, we have 3 line-heights:

  • general body texts: 1.2
  • headings: 1
  • links for the navigation items: 1.1

The pencil banner and footer text both inherit the general body text line height of 1.2.

  1. So we should definitely specifically define the line-height for the navigation. It is a specific design and should be consistent globally.
  2. The pencil banner line height should also be specified here for now. Since it is an global element appears on both old and new page designs. I think to override the old protocol default line-height might needs much more testing before we proceed. For now, we might have to specify line-height for the new global components (setting the line-height for <main> will not be helpful global components like pencil banner or footer).

I hope this helps answer the question regarding the footer line-height too.

@janbrasna

This comment was marked as outdated.

@janbrasna janbrasna changed the title Force consistent header height Use consistent line heights (nav, footer, CTAs, content) in old&new pages Jan 9, 2025
Copy link
Collaborator Author

@janbrasna janbrasna left a comment

Choose a reason for hiding this comment

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

BTW I have followed the above posted metrics "literally" in this branch to test out, the biggest impact is perhaps all the pre-refresh pages that got line-height 1.4 at #15144 — and these would change now to 1.2 wholesale.

Another impact is e.g. the submenu that would need further tweaks after the line-height moving out of align with the logo:

Screenshot 2025-01-10 at 1 11 07

Generally there seems to be rules coming from different stages or the refresh, ending up rendering slightly differently on the output. We ran into another interaction between m24-base and protocol-mozilla-2024 today, and it would seem like the duplication/inheritance causes some woes — so maybe only using one or the other separately will be more manageable in the end.

background-color: $m24-color-white;
color: $m24-color-black;
font-family: var(--body-font-family);
font-variant-ligatures: none;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

BTW, why was font-variant-ligatures: none specified, and only for the m24-base pages, while all other use the typeface too, without that disabled?

@wen-2018 Would you know perhaps? Or was it when the typeface was "too BETA" and used to have issues with rendering ligatures? (So is it safe to remove now?)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's likely font-variant-ligatures was disabled for M24 when the font is still in beta.

@stephaniehobson Could you confirm this is the case and we could remove them in M24 base styles now?

Copy link
Contributor

Choose a reason for hiding this comment

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

Font ligatures are an accessibility concern. Changing the shape of the letters by combining them introduces problems for some readers. We should keep them disabled in the base styles.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, okay, I thought that a11y override would come from UA styles, if preferred.

I'll try to make that consistent between the old and the new pages then.
Thanks for the info, appreciate it.

@wen-2018
Copy link
Collaborator

Thinking aloud… this should start with redefining --body-line-height:1.4 on protocol-mozilla-2024 to start with, to apply the 1.2 to all the content, old and new?

I think the goal is to build a brand new design system like the current protocol but for the new M24 styles evetually. So we might not want to override the default body line for the pages/components using the protocol designs. The line-heights I listed above are for components/pages using the M24 styles.

In summary:

@janbrasna
Copy link
Collaborator Author

OK, so the other way around how it inherits today — protocol-mozilla-2024 should not override any metrics from the refreshed components older pages may use, esp. nav & footer.

I'll think about that. Thanks for the info.

@janbrasna janbrasna marked this pull request as draft January 10, 2025 14:28
@janbrasna janbrasna closed this May 1, 2025
@janbrasna
Copy link
Collaborator Author

janbrasna commented May 1, 2025

Resolved in #16156 for M24 vs. non-M24 pages; now only Fx-themed header, footer and mobile menu align differently — it's not that pressing now as navigating between these two types of pages is not frequent and some don't even include the header at all etc. …

I'm thinking that for the Fx-theme base it would be viable to just constrain the tweaks to the main content only, and let the global components use the default theme values without having to define them again explicitly somewhere.

@janbrasna janbrasna deleted the fix/header-height branch May 1, 2025 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend HTML, CSS, JS... client side stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Footer line-height changes between pages Header moves between pages

3 participants