-
Notifications
You must be signed in to change notification settings - Fork 159
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
feat(masthead-v2): add masthead to document flow #10998
feat(masthead-v2): add masthead to document flow #10998
Conversation
Deploy preview created for package Built with commit: 76b6abd1a4ef0d24e15f9162f474379febf0223e |
Deploy preview created for package Built with commit: 76b6abd1a4ef0d24e15f9162f474379febf0223e |
Deploy preview created for package Built with commit: 76b6abd1a4ef0d24e15f9162f474379febf0223e |
Deploy preview created for package Built with commit: 76b6abd1a4ef0d24e15f9162f474379febf0223e |
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.
This looks pretty good - suggesting a change from mutationObserver
to resizeObserver
packages/web-components/src/components/masthead/masthead-composite.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/masthead/masthead-composite.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/masthead/masthead-composite.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/masthead/masthead-composite.ts
Outdated
Show resolved
Hide resolved
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.
Looks great! Just small comment about updating a comment.
packages/web-components/src/components/masthead/masthead-composite.ts
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/masthead/masthead-composite.ts
Outdated
Show resolved
Hide resolved
9ff1d18
to
ec719e5
Compare
packages/web-components/src/components/masthead/masthead-composite.ts
Outdated
Show resolved
Hide resolved
Deploy preview created for package Built with commit: 76b6abd1a4ef0d24e15f9162f474379febf0223e |
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.
LGTM thanks @jkaeser!
e1debd8
into
carbon-design-system:feat/masthead-v2-dev
…m#10998) * feat(masthead-v2): put container in document flow * feat(masthead-v2): format code * feat(masthead-v2): update height on resize * feat(masthead-v2): accurately describe observer * feat(masthead-v2): debounce resize observer callback * feat(masthead-v2): execute callback once after successive resizes --------- Co-authored-by: Andy Blum <[email protected]>
### Related Ticket(s) none ### Description We made some enhancements to the alpha v2 masthead after we'd integrated its branch into the main C4IBM v2 branch. This PR ports those enhancements over. - **fix(masthead-v2): use more explicit selector in dropdown toggle** (911f802) ([Original PR](#11084)) - **feat(masthead-v2): add masthead to document flow** (e1debd8) ([Original PR](#10998)) - **feat(masthead-v2): Minimize CMApp on megamenu open** (c4a06f3) ([Original PR](#11085)) - **fix(masthead-v2): do not fail if object data does not exist** (c9609f7) ([Original PR](#11205)) - **fix(masthead-v2): ensure L1 dropdown targets exist** (fc65086) ([Original PR](#11254)) - **fix(masthead-v2): provide accessible nav label** (f183d25) ([Original PR](#11269)) - **fix(sticky-header): prevent negative overscroll from hiding stuck elements** (51015ed) ([Original PR](#11266)) <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "test: e2e": Codesandbox examples and e2e integration tests --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
…ign-system#11183) none We made some enhancements to the alpha v2 masthead after we'd integrated its branch into the main C4IBM v2 branch. This PR ports those enhancements over. - **fix(masthead-v2): use more explicit selector in dropdown toggle** (911f802) ([Original PR](carbon-design-system#11084)) - **feat(masthead-v2): add masthead to document flow** (e1debd8) ([Original PR](carbon-design-system#10998)) - **feat(masthead-v2): Minimize CMApp on megamenu open** (c4a06f3) ([Original PR](carbon-design-system#11085)) - **fix(masthead-v2): do not fail if object data does not exist** (c9609f7) ([Original PR](carbon-design-system#11205)) - **fix(masthead-v2): ensure L1 dropdown targets exist** (fc65086) ([Original PR](carbon-design-system#11254)) - **fix(masthead-v2): provide accessible nav label** (f183d25) ([Original PR](carbon-design-system#11269)) - **fix(sticky-header): prevent negative overscroll from hiding stuck elements** (51015ed) ([Original PR](carbon-design-system#11266)) <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "test: e2e": Codesandbox examples and e2e integration tests --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
Related Ticket(s)
Description
The visible parts of the masthead are
position: fixed;
, which prevents them from being in the document flow. This forces adopters to manually add spacing to their page content so the masthead doesn't overlap. We provide the--dds-sticky-header-height
variable via the StickyHeader utility as a value to use, but this changes as the user scrolls, creating a potentially unwanted parallax effect.To overcome this, we force the masthead's container into the document flow by giving it a height equal to its visible parts' height. This avoids the parallax effect, and adopters should only need to add the spacing they want between their content and the masthead, rather than solving for the masthead's height in some way.
Testing
Visit deploy preview Stories for the masthead with and without the L1. In each, use the browser dev tools to inspect the element and find the
<dds-masthead-container>
or<dds-masthead-composite>
(they are mostly analogous). It should have a CSSheight
set on it equal to the<dds-masthead>
element's height.Changelog
Changed