Skip to content

Conversation

alistair3149
Copy link
Member

@alistair3149 alistair3149 commented Sep 27, 2025

Summary by CodeRabbit

  • New Features

    • Unified, side-aware header theming and offsets for top/bottom/left/right placements, improving layout consistency across viewports.
    • Always-on frosted-glass backdrop for supported browsers.
  • Refactor

    • Migrated layout to logical properties and granular header variables (block/inline start/end), simplifying sticky/header behaviors.
    • Standardized spacing/positioning for ToC, page actions, Footer, Menu, Overflow elements, Cookie Warning, Echo, MediaSearch, VisualEditor, Preferences, DataTables, and Debug toolbar to prevent overlap and ensure correct offsets.
  • Style

    • Updated lint directives and comment syntax; no functional impact.

@coderabbitai
Copy link

coderabbitai bot commented Sep 27, 2025

Walkthrough

Refactors header sizing/offset variables to logical block/inline variants across core skin and extensions; updates header layout to inset/border logical properties; simplifies sticky header transforms and margins; adjusts scroll-padding and transforms; introduces comprehensive header tokens and desktop/mobile overrides; and applies minor lint/comment updates.

Changes

Cohort / File(s) Summary
Linting and comment adjustments
./.stylelintrc.json, resources/skins.citizen.styles/common/progressbar.less, resources/skins.citizen.styles/common/viewTransition.less, skinStyles/extensions/Popups/ext.popups.main.less
Update stylelint rule option; convert C-style to line comments; insert stylelint disable notes. No functional CSS changes.
Core mixins and header tokens
resources/mixins.less, resources/skins.citizen.styles/tokens-citizen.less
Mixins: always apply backdrop-filter; simplify sticky header mixin to use --header-offset-block-start. Tokens: add logical header size/inset/border/offset variables with desktop/mobile and position overrides.
Common base styles and layout
resources/skins.citizen.styles/common/common.less, resources/skins.citizen.styles/common/features.less, resources/skins.citizen.styles/layout.less
Replace --height-sticky-header/--header-size usages with --header-offset-block-start/end; add bottom scroll-padding; update transforms; convert directional margins to logical block/inline.
Header and sticky containers
resources/skins.citizen.styles/components/Header.less, resources/skins.citizen.styles/components/StickyHeader.less, resources/skins.citizen.styles/components/OverflowElements.less
Shift to logical insets and explicit border properties; remove per-position branches; unify desktop margins; drop transform-based top positioning; update sticky transforms to --header-offset-block-start.
Navigation and UI components
resources/skins.citizen.styles/components/Footer.less, resources/skins.citizen.styles/components/Menu.less, resources/skins.citizen.styles/components/Pagetools.less, resources/skins.citizen.styles/components/TableOfContents.less
Footer/Pagetools: use --header-size-block-end. Menu: remove outer content-visibility @supports; apply properties directly; add lint suppressions. ToC: replace offset vars, remove header-state conditionals, keep sticky with new --header-offset-block-start.
Extension style adjustments
skinStyles/extensions/CookieWarning/ext.CookieWarning.styles.less, skinStyles/extensions/Echo/ext.echo.ui.less, skinStyles/extensions/MediaSearch/mediasearch.styles.less, skinStyles/extensions/SearchDigest/ext.searchdigest.styles.less, skinStyles/extensions/SemanticResultFormats/datatables/ext.srf.datatables.v2.format.less, skinStyles/extensions/VisualEditor/ext.visualEditor.core.less, skinStyles/extensions/VisualEditor/ext.visualEditor.desktopArticleTarget.init.less
Replace generic --header-size/--height-sticky-header with logical start/end/inline vars; adjust transforms/offsets; remove some conditional/media-query branches; add header offset var in VE activation.
Debug and special pages
skinStyles/mediawiki/debug/mediawiki.debug.less, skinStyles/mediawiki/special/mediawiki.special.preferences.styles.ooui.less
Add debug toolbar height var; switch to logical margins; adjust z-index; add targeted hacks for toolbar presence; standardize submit buttons’ bottom offset to --header-size-block-end and remove conditional rules.

Sequence Diagram(s)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

A rabbit taps keys with a hop and a glide,
Block-start, block-end—now neatly aligned.
Insets replace corners, borders stand tall,
Tokens abound for headers big and small.
With lint hushed softly, I thump in delight—
CSS burrow tidied, snug for the night. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately captures the primary change of this pull request, which is introducing and leveraging CSS variables to define and control header behavior across the codebase. It refers directly to the header feature scope and notes the adoption of CSS variables as the central theme of the refactor. This aligns with the extensive updates in the raw summary that replace static header size values with new CSS custom properties for header insets, offsets, and sizing. Thus it is concise, clear, and focused on the main change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-headervars

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

This will make the styles more consolidated and maintainable.
Also fix some of the incorrect styles for top/bottom header mode.
@alistair3149 alistair3149 changed the title refactor(header): ♻️ use CSS variables to define header behavior feat(header): ✨ use CSS variables to define header behavior Sep 30, 2025
@alistair3149 alistair3149 marked this pull request as ready for review September 30, 2025 01:57
@sonarqubecloud
Copy link

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
skinStyles/extensions/VisualEditor/ext.visualEditor.desktopArticleTarget.init.less (1)

11-13: LGTM! Variable migration aligns with PR objectives.

The update to use --header-offset-block-start and --header-size-block-start correctly aligns with the refactor to logical property variants.

Optional: Consider documenting the 48px offset.

The 48px value in the calculation lacks context. Consider adding a comment explaining what this offset represents (e.g., toolbar padding, visual spacing, etc.) or extracting it to a named CSS variable for better maintainability.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c083f0 and e8ceafa.

📒 Files selected for processing (25)
  • .stylelintrc.json (1 hunks)
  • resources/mixins.less (2 hunks)
  • resources/skins.citizen.styles/common/common.less (1 hunks)
  • resources/skins.citizen.styles/common/features.less (2 hunks)
  • resources/skins.citizen.styles/common/progressbar.less (1 hunks)
  • resources/skins.citizen.styles/common/viewTransition.less (1 hunks)
  • resources/skins.citizen.styles/components/Footer.less (1 hunks)
  • resources/skins.citizen.styles/components/Header.less (2 hunks)
  • resources/skins.citizen.styles/components/Menu.less (2 hunks)
  • resources/skins.citizen.styles/components/OverflowElements.less (1 hunks)
  • resources/skins.citizen.styles/components/Pagetools.less (1 hunks)
  • resources/skins.citizen.styles/components/StickyHeader.less (1 hunks)
  • resources/skins.citizen.styles/components/TableOfContents.less (2 hunks)
  • resources/skins.citizen.styles/layout.less (1 hunks)
  • resources/skins.citizen.styles/tokens-citizen.less (1 hunks)
  • skinStyles/extensions/CookieWarning/ext.CookieWarning.styles.less (1 hunks)
  • skinStyles/extensions/Echo/ext.echo.ui.less (1 hunks)
  • skinStyles/extensions/MediaSearch/mediasearch.styles.less (1 hunks)
  • skinStyles/extensions/Popups/ext.popups.main.less (1 hunks)
  • skinStyles/extensions/SearchDigest/ext.searchdigest.styles.less (1 hunks)
  • skinStyles/extensions/SemanticResultFormats/datatables/ext.srf.datatables.v2.format.less (1 hunks)
  • skinStyles/extensions/VisualEditor/ext.visualEditor.core.less (1 hunks)
  • skinStyles/extensions/VisualEditor/ext.visualEditor.desktopArticleTarget.init.less (2 hunks)
  • skinStyles/mediawiki/debug/mediawiki.debug.less (2 hunks)
  • skinStyles/mediawiki/special/mediawiki.special.preferences.styles.ooui.less (1 hunks)
🔇 Additional comments (41)
skinStyles/extensions/VisualEditor/ext.visualEditor.desktopArticleTarget.init.less (1)

50-56: LGTM! Toolbar positioning updated correctly.

The migration from a generic header size token to --header-size-block-start is consistent with the PR's refactor to use logical block/inline variants for header behavior.

resources/skins.citizen.styles/common/progressbar.less (1)

68-68: LGTM! Comment syntax standardization.

The change from block-style to line-style comment is a stylistic improvement that aligns with the broader comment syntax updates across the PR.

skinStyles/extensions/Popups/ext.popups.main.less (1)

97-98: LGTM! Appropriate use of stylelint disable.

Adding the stylelint disable comment for the @supports block is appropriate, as feature detection patterns inherently test for baseline support. This acknowledges the intentional use of progressive enhancement for the clip-path property.

resources/skins.citizen.styles/common/viewTransition.less (1)

2-2: LGTM! Comment syntax standardization.

The change from block-style to line-style comment is consistent with the comment syntax updates across the PR.

skinStyles/extensions/SearchDigest/ext.searchdigest.styles.less (1)

33-36: Approve code changes; CSS variable is defined
The --header-offset-block-start variable is declared in resources/skins.citizen.styles/tokens-citizen.less (line 145) and is consistently referenced across styles (including SearchDigest), so the migration is complete.

.stylelintrc.json (1)

24-24: Verified: no new stylelint issues with “newly” baseline
Stylelint ran against all CSS/LESS files and reported no use-baseline warnings. Ensure this stricter baseline aligns with your browser support policy before merging.

resources/skins.citizen.styles/common/common.less (1)

4-5: LGTM! Improved scroll-padding with logical properties.

The refactoring correctly applies logical properties for scroll padding. The new --header-offset-block-start variable provides a more comprehensive offset calculation that accounts for both the base header size and sticky header height, which improves accuracy. The addition of scroll-padding-bottom ensures consistent spacing on both ends.

resources/skins.citizen.styles/common/features.less (2)

131-131: Good addition for consistency.

Setting --header-size-block-end: 0 in the scroll-down state aligns with the existing pattern of zeroing out --height-sticky-header and ensures that components using this variable respond correctly to the autohide behavior.


148-148: Improved semantic correctness with logical property.

The change from var(--header-size) to var(--header-offset-block-end) is more semantically precise, as it specifically targets the block-end offset rather than a generic size value. This aligns with the logical properties refactoring throughout the PR.

skinStyles/extensions/MediaSearch/mediasearch.styles.less (1)

768-768: LGTM! Consistent with logical properties refactoring.

The change from --header-size to --header-size-block-end provides better semantic clarity and aligns with the PR's goal of using logical properties. The centralized token definitions in tokens-citizen.less handle responsive behavior, which simplifies this extension's stylesheet.

skinStyles/extensions/Echo/ext.echo.ui.less (5)

21-21: LGTM! Logical property usage for bottom positioning.

The change to --header-size-block-end correctly uses logical properties for vertical positioning.


29-29: LGTM! Logical property usage for left positioning.

The change to --header-size-inline-start correctly uses logical properties for horizontal positioning when the header is on the left.


33-33: LGTM! Logical property usage for right positioning.

The change to --header-size-inline-end correctly uses logical properties for horizontal positioning when the header is on the right.


39-39: LGTM! Logical property usage for top positioning.

The change to --header-size-block-start correctly uses logical properties for vertical positioning when the header is on top.


47-47: LGTM! Logical property usage for bottom positioning.

The change to --header-size-block-end correctly uses logical properties for vertical positioning when the header is on the bottom.

resources/skins.citizen.styles/tokens-citizen.less (3)

130-147: Excellent token architecture for header positioning.

The new header position tokens provide a comprehensive and well-structured system for managing header layout across different positions and orientations. Key strengths:

  • Logical properties (block/inline) for proper internationalization support
  • Separate size, inset, border, and offset variables for fine-grained control
  • --header-offset-block-start correctly accounts for both base header size and sticky header height
  • All default values initialized to 0 for safe fallback behavior

149-157: Good mobile-first approach with forced bottom positioning.

The mobile breakpoint override ensures consistent behavior on smaller screens by defaulting to bottom positioning with horizontal layout, regardless of desktop configuration. This simplifies the mobile experience while maintaining responsive design principles.


159-203: Comprehensive desktop position handling.

The position-specific rules correctly implement the four header positions:

  • left/right: Use column direction with inline sizing and appropriate border on the opposite edge
  • top/bottom: Use row direction with block sizing and appropriate border on the opposite edge

The border placement (e.g., border-inline-end for left position) creates proper visual separation between the header and content.

skinStyles/mediawiki/special/mediawiki.special.preferences.styles.ooui.less (1)

33-33: LGTM! Simplified header offset using logical property.

The change to --header-size-block-end simplifies the positioning logic by removing responsive and state-based adjustments, aligning with the PR's token-based refactor.

resources/skins.citizen.styles/components/Menu.less (2)

91-91: LGTM! Appropriate stylelint suppression for @supports blocks.

The plugin/use-baseline suppression is appropriate here since these @supports blocks handle fallbacks for properties (mask-image) with limited browser support and vendor prefixes.

Also applies to: 98-98


78-82: Confirm browser support policy for content-visibility.
We ran checks for a .browserslistrc, package.json browserlist, and support docs but none were found. Ensure applying content-visibility unconditionally (and its transitions) aligns with your enabled browser targets.

skinStyles/mediawiki/debug/mediawiki.debug.less (4)

14-14: LGTM! Debug toolbar height definition.

The hardcoded 54px value is acceptable here since it matches the fixed height of MediaWiki's debug toolbar, though ideally this would be derived from a core constant if available.


21-22: LGTM! Proper use of logical properties for margins.

The migration to margin-block-end and margin-inline with the new header token variables correctly implements the logical property refactor, ensuring proper spacing in different writing modes.


17-17: Verify upstream z-index values for @z-index-toolbar vs @z-index-sticky. Definitions aren’t present in this repo—confirm that @z-index-sticky yields the intended layering for the debug toolbar relative to headers, ToC, and other sticky elements.


152-168: Approve debug toolbar adjustments. Verified CSS :has() support
Verified that the CSS :has() selector is safe to use under Baseline 2023—supported in Chrome/Edge from v105, Safari from 15.4, and Firefox from 121 (caniuse.com). Retain the TODO for a more universal bottom-toolbar solution.

skinStyles/extensions/SemanticResultFormats/datatables/ext.srf.datatables.v2.format.less (1)

38-38: LGTM! Improved semantic clarity for header offset.

The change from --height-sticky-header to --header-offset-block-start provides better semantic clarity and aligns with the PR's token-based refactor for header positioning.

resources/skins.citizen.styles/components/Footer.less (1)

15-15: LGTM! Consistent footer spacing with new header tokens.

The migration to --header-size-block-end properly reserves space for the bottom-positioned header when autohide navigation is disabled, maintaining the existing behavior with improved semantic clarity.

resources/skins.citizen.styles/components/OverflowElements.less (1)

68-68: LGTM! Logical property migration for sticky header transform.

The vertical offset now correctly uses --header-offset-block-start instead of --height-sticky-header, aligning with the PR's systematic migration to logical block/inline properties.

resources/skins.citizen.styles/components/Pagetools.less (1)

160-160: LGTM! Logical property for bottom positioning.

The bottom offset calculation now correctly uses --header-size-block-end, consistent with the PR's migration to logical block properties for header sizing.

skinStyles/extensions/CookieWarning/ext.CookieWarning.styles.less (2)

34-34: LGTM! Logical inline property for horizontal positioning.

Correctly uses --header-size-inline-start for the left offset when the header is positioned on the left side.


39-39: LGTM! Logical block property for vertical positioning.

Correctly uses --header-size-block-end for the bottom offset when the header is positioned at the bottom.

resources/skins.citizen.styles/layout.less (1)

42-43: LGTM! Consolidation to logical properties.

The refactor from four directional margin properties to two logical properties (margin-block and margin-inline) improves maintainability and correctly applies the new granular header-size tokens for all four edges.

skinStyles/extensions/VisualEditor/ext.visualEditor.core.less (1)

19-21: Verify global .ve-ui-toolbar-floating top offset
This rule was widened from header-top only to all floating toolbars—test under left and bottom header positions to ensure --header-size-block-start doesn’t cause layout regressions (skinStyles/extensions/VisualEditor/ext.visualEditor.core.less:19-21)

resources/skins.citizen.styles/components/TableOfContents.less (2)

215-216: LGTM! Desktop ToC positioning uses header offset correctly.

The desktop ToC now consistently uses --header-offset-block-start for both vertical positioning and height calculations, aligning with the token-driven approach.


158-158: LGTM—--header-size-block-end is defined in tokens-citizen.less for default and mobile breakpoints.

resources/skins.citizen.styles/components/Header.less (3)

167-172: LGTM! Logical property shorthands reduce verbosity.

Using inset-block and inset-inline shorthands at the desktop breakpoint is more concise while maintaining the same functionality as the individual longhand properties.


5-8: LGTM – all --header-inset-* variables are defined in tokens-citizen.less.

Switching from explicit edges to these variables centralizes header positioning and enhances maintainability.


15-21: LGTM! All four header border-width variables are defined. Defaults and per-position overrides in tokens-citizen.less cover each logical edge.

resources/skins.citizen.styles/components/StickyHeader.less (1)

42-44: Resolved: CSS header-size variables are defined All required variables (--header-size-block-start, --header-size-block-end, --header-size-inline-start, --header-size-inline-end) are declared in resources/skins.citizen.styles/tokens-citizen.less.

resources/mixins.less (2)

54-59: CSS variable definitions confirmed.
--header-offset-block-start is defined in resources/skins.citizen.styles/tokens-citizen.less (and overridden in skinStyles/extensions/VisualEditor/ext.visualEditor.desktopArticleTarget.init.less).


16-20: Confirm backdrop-filter compatibility. Fallback via .mixin-citizen-opaque-background still covers UAs without backdrop-filter, and both -webkit- and unprefixed properties are output; please verify that your browserslist targets (via browserslist-config-wikimedia) no longer include browsers that lack any form of backdrop-filter support.

@alistair3149 alistair3149 merged commit ada6352 into main Sep 30, 2025
7 checks passed
@alistair3149 alistair3149 deleted the refactor-headervars branch September 30, 2025 02:04
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.

1 participant