Skip to content

PoC for sticky tabs and chips on the FDH. - #13968

Draft
techanvil wants to merge 3 commits into
developfrom
trh/fdh-sticky-behaviour
Draft

techanvil wants to merge 3 commits into
developfrom
trh/fdh-sticky-behaviour

Conversation

@techanvil

Copy link
Copy Markdown
Collaborator

Summary

This is a PoC, do not merge.

Related issue(s):

Relevant technical choices

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.
  • Ensure there are no unexpected significant changes to file sizes.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces sticky positioning and layout adjustments for the feature discovery tab bar and category filter chips. Feedback on these changes highlights that the media query calculations result in invalid CSS (e.g., '769pxpx') and should be updated to use media query range syntax. Additionally, it is recommended to avoid hardcoding the tab bar height to 57px to prevent layout issues when text wraps, suggesting instead to wrap both elements in a single sticky parent container.

Comment on lines +38 to +48
@media (min-width: $width-tablet + 1 + px) {
--googlesitekit-feature-discovery-sticky-top: 114px;
}

@media (min-width: $bp-wpAdminBarTablet) {
--googlesitekit-feature-discovery-sticky-top: 100px;
}

@media (min-width: $width-desktop + 1 + px) {
--googlesitekit-feature-discovery-sticky-top: 116px;
}

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.

high

Using $width-tablet + 1 + px and $width-desktop + 1 + px results in invalid CSS values like 769pxpx and 961pxpx because Sass automatically adds the unit of the first operand when adding a unitless number, and then concatenates the px string. This causes the browser to ignore these media queries entirely.

Additionally, we should use media query range syntax (e.g., width > $width-tablet) instead of traditional min/max declarations to comply with Stylelint configurations that enforce range syntax.

Suggested change
@media (min-width: $width-tablet + 1 + px) {
--googlesitekit-feature-discovery-sticky-top: 114px;
}
@media (min-width: $bp-wpAdminBarTablet) {
--googlesitekit-feature-discovery-sticky-top: 100px;
}
@media (min-width: $width-desktop + 1 + px) {
--googlesitekit-feature-discovery-sticky-top: 116px;
}
@media (width > $width-tablet) {
--googlesitekit-feature-discovery-sticky-top: 114px;
}
@media (width >= $bp-wpAdminBarTablet) {
--googlesitekit-feature-discovery-sticky-top: 100px;
}
@media (width > $width-desktop) {
--googlesitekit-feature-discovery-sticky-top: 116px;
}
References
  1. The repository style guide prioritizes concrete CSS correctness, including avoiding invalid or conflicting style declarations. (link)
  2. Use media query range syntax (e.g., height >= 540px) instead of traditional min/max declarations (e.g., min-height: 540px) in SCSS to comply with Stylelint configurations that enforce range syntax.

// All services category chips stick below the tab bar. Offsets match
// `.googlesitekit-navigation`, which sticks below the same header.
--googlesitekit-feature-discovery-sticky-top: 68px;
--googlesitekit-feature-discovery-tab-bar-height: 57px; // 56px tabs + 1px border.

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.

medium

Hardcoding the tab bar height to 57px is fragile because tab labels can wrap to multiple lines on smaller screens or when translated into other languages (which often have longer strings). If the tab bar height increases, the category chips will overlap the tab bar.

Instead of calculating offsets with hardcoded heights, a more robust approach is to wrap both the tab bar and the category filter chips in a single parent container (e.g., .googlesitekit-feature-discovery__sticky-header) and make that parent container position: sticky. This allows the elements to flow naturally and adapt to any dynamic height changes without needing manual calculations.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🤖 This comment is automatically updated by CI workflows. Each section is managed independently.

📚 Storybook for bf1809f:

📦 Build files for bf1809f:

🖼️ VRT report for bf1809f:

🎭 Playwright reports for a1e3350:

@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 3.49 MB

ℹ️ View Unchanged
Filename Size Change
dist/assets/blocks/reader-revenue-manager/block-editor-plugin/editor-styles.css 124 B 0 B
dist/assets/blocks/reader-revenue-manager/block-editor-plugin/editor-styles.js 0 B 0 B 🆕
dist/assets/blocks/reader-revenue-manager/block-editor-plugin/index.js 46.5 kB 0 B
dist/assets/blocks/reader-revenue-manager/common/editor-styles.css 307 B 0 B
dist/assets/blocks/reader-revenue-manager/common/editor-styles.js 0 B 0 B 🆕
dist/assets/blocks/reader-revenue-manager/contribute-with-google/index.js 7.08 kB 0 B
dist/assets/blocks/reader-revenue-manager/contribute-with-google/non-site-kit-user.js 6.29 kB 0 B
dist/assets/blocks/reader-revenue-manager/subscribe-with-google/index.js 7.09 kB 0 B
dist/assets/blocks/reader-revenue-manager/subscribe-with-google/non-site-kit-user.js 6.29 kB 0 B
dist/assets/blocks/sign-in-with-google/editor-styles.css 84 B 0 B
dist/assets/blocks/sign-in-with-google/editor-styles.js 0 B 0 B 🆕
dist/assets/blocks/sign-in-with-google/index.js 18.5 kB 0 B
dist/assets/css/googlesitekit-admin-css-********************.min.css 79.2 kB +158 B (+0.2%)
dist/assets/css/googlesitekit-adminbar-css-********************.min.css 12.7 kB 0 B
dist/assets/css/googlesitekit-authorize-application-css-********************.min.css 851 B 0 B
dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 9.09 kB 0 B
dist/assets/js/20-********************.js 1.03 kB 0 B
dist/assets/js/22-********************.js 2.41 kB 0 B
dist/assets/js/212-********************.js 2.26 kB 0 B
dist/assets/js/315-********************.js 3.08 kB 0 B
dist/assets/js/397-********************.js 477 kB 0 B
dist/assets/js/492-********************.js 970 B 0 B
dist/assets/js/603-********************.js 61.5 kB 0 B
dist/assets/js/741-********************.js 3.84 kB 0 B
dist/assets/js/792-********************.js 110 kB 0 B
dist/assets/js/959-********************.js 3 kB 0 B
dist/assets/js/analytics-advanced-tracking-********************.js 428 B 0 B
dist/assets/js/googlesitekit-activation-********************.js 31.2 kB 0 B
dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 70.3 kB 0 B
dist/assets/js/googlesitekit-admin-pointers-tracking-********************.js 6.61 kB 0 B
dist/assets/js/googlesitekit-adminbar-********************.js 38.1 kB 0 B
dist/assets/js/googlesitekit-api-********************.js 9.86 kB 0 B
dist/assets/js/googlesitekit-block-tracking-********************.js 6.82 kB 0 B
dist/assets/js/googlesitekit-components-********************.js 6.92 kB 0 B
dist/assets/js/googlesitekit-consent-mode-********************.js 25.5 kB 0 B
dist/assets/js/googlesitekit-data-********************.js 1.83 kB 0 B
dist/assets/js/googlesitekit-datastore-forms-********************.js 8.44 kB 0 B
dist/assets/js/googlesitekit-datastore-location-********************.js 1.6 kB 0 B
dist/assets/js/googlesitekit-datastore-pdf-********************.js 1.22 kB 0 B
dist/assets/js/googlesitekit-datastore-site-********************.js 21.4 kB 0 B
dist/assets/js/googlesitekit-datastore-ui-********************.js 8.6 kB 0 B
dist/assets/js/googlesitekit-datastore-user-********************.js 26.6 kB 0 B
dist/assets/js/googlesitekit-entity-dashboard-********************.js 94 kB 0 B
dist/assets/js/googlesitekit-events-provider-contact-form-7-********************.js 1.27 kB 0 B
dist/assets/js/googlesitekit-events-provider-content-events-********************.js 3.16 kB 0 B
dist/assets/js/googlesitekit-events-provider-easy-digital-downloads-********************.js 651 B 0 B
dist/assets/js/googlesitekit-events-provider-mailchimp-********************.js 1.24 kB 0 B
dist/assets/js/googlesitekit-events-provider-ninja-forms-********************.js 1.26 kB 0 B
dist/assets/js/googlesitekit-events-provider-optin-monster-********************.js 1.28 kB 0 B
dist/assets/js/googlesitekit-events-provider-popup-maker-********************.js 1.35 kB 0 B
dist/assets/js/googlesitekit-events-provider-woocommerce-********************.js 895 B 0 B
dist/assets/js/googlesitekit-events-provider-wpforms-********************.js 1.3 kB 0 B
dist/assets/js/googlesitekit-feature-discovery-********************.js 18.2 kB 0 B
dist/assets/js/googlesitekit-features-********************.js 87.8 kB 0 B
dist/assets/js/googlesitekit-features-badge-********************.js 835 B 0 B
dist/assets/js/googlesitekit-i18n-********************.js 4.43 kB 0 B
dist/assets/js/googlesitekit-intents-********************.js 9.28 kB 0 B
dist/assets/js/googlesitekit-key-metrics-setup-********************.js 65.2 kB 0 B
dist/assets/js/googlesitekit-main-dashboard-********************.js 227 kB 0 B
dist/assets/js/googlesitekit-metric-selection-********************.js 68 kB 0 B
dist/assets/js/googlesitekit-modules-********************.js 30.3 kB 0 B
dist/assets/js/googlesitekit-modules-ads-********************.js 61 kB 0 B
dist/assets/js/googlesitekit-modules-adsense-********************.js 156 kB 0 B
dist/assets/js/googlesitekit-modules-analytics-4-********************.js 310 kB 0 B
dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 31.6 kB 0 B
dist/assets/js/googlesitekit-modules-reader-revenue-manager-********************.js 138 kB 0 B
dist/assets/js/googlesitekit-modules-search-console-********************.js 78.8 kB 0 B
dist/assets/js/googlesitekit-modules-sign-in-with-google-********************.js 40.2 kB 0 B
dist/assets/js/googlesitekit-modules-tagmanager-********************.js 34.3 kB 0 B
dist/assets/js/googlesitekit-notifications-********************.js 95.8 kB 0 B
dist/assets/js/googlesitekit-polyfills-********************.js 227 B 0 B
dist/assets/js/googlesitekit-settings-********************.js 88.9 kB 0 B
dist/assets/js/googlesitekit-splash-********************.js 73 kB 0 B
dist/assets/js/googlesitekit-user-input-********************.js 59.5 kB 0 B
dist/assets/js/googlesitekit-vendor-********************.js 314 kB 0 B
dist/assets/js/googlesitekit-vendor-lazy-pdf-********************.js 24.6 kB 0 B
dist/assets/js/googlesitekit-widgets-********************.js 186 kB 0 B
dist/assets/js/googlesitekit-wp-dashboard-********************.js 46.6 kB 0 B
dist/assets/js/runtime-********************.js 1.94 kB 0 B
dist/assets/js/sign-in-with-google-********************.js 1.35 kB 0 B

compressed-size-action

@techanvil
techanvil marked this pull request as draft October 26, 2026 13:35

This branch has not been deployed

No deployments
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