Repository navigation
PoC for sticky tabs and chips on the FDH. #13968
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,27 @@ | |||||||||||||||||||||||||||||||||||||||||||||
| --googlesitekit-feature-discovery-padding-m: 36px; | ||||||||||||||||||||||||||||||||||||||||||||||
| --googlesitekit-feature-discovery-padding-l: 48px; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| // The tab bar sticks directly below the sticky Site Kit header, and the | ||||||||||||||||||||||||||||||||||||||||||||||
| // 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. | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| body.admin-bar & { | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @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; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+38
to
+48
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using Additionally, we should use media query range syntax (e.g.,
Suggested change
References
|
||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| .googlesitekit-feature-discovery__header { | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -40,6 +61,18 @@ | |||||||||||||||||||||||||||||||||||||||||||||
| padding-inline: var(--googlesitekit-feature-discovery-padding-m); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| .googlesitekit-feature-discovery__tab-bar { | ||||||||||||||||||||||||||||||||||||||||||||||
| background-color: $c-base; | ||||||||||||||||||||||||||||||||||||||||||||||
| position: sticky; | ||||||||||||||||||||||||||||||||||||||||||||||
| top: var(--googlesitekit-feature-discovery-sticky-top); | ||||||||||||||||||||||||||||||||||||||||||||||
| z-index: 10; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| body.googlesitekit-showing-feature-tour &, | ||||||||||||||||||||||||||||||||||||||||||||||
| body.googlesitekit-showing-tooltip & { | ||||||||||||||||||||||||||||||||||||||||||||||
| position: static; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| .googlesitekit-feature-discovery__content { | ||||||||||||||||||||||||||||||||||||||||||||||
| min-block-size: 546px; | ||||||||||||||||||||||||||||||||||||||||||||||
| padding-block: 0 var(--googlesitekit-feature-discovery-padding-l); | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoding the tab bar height to
57pxis 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 containerposition: sticky. This allows the elements to flow naturally and adapt to any dynamic height changes without needing manual calculations.