Skip to content
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

fix(sticky-header): do not consider vertical ToC height in calculations #10605

Conversation

jkaeser
Copy link
Contributor

@jkaeser jkaeser commented Jun 26, 2023

Related Ticket(s)

Description

The StickyHeader utility has logic for how to calculate the total height of elements on a given web page that are "stuck" to the top of the viewport. It exposes a CSS custom property, --dds-sticky-header-height, with this calculated value for other page elements to use.

In AEM, we were seeing this value be set much higher than the actual sum height of all stuck elements. It turns out we were adding the height of <dds-table-of-contents> elements that are configured to use the vertical presentation, which is unnecessary.

Changelog

Changed

  • Removes <dds-table-of-contents> in the vertical orientation from --dds-sticky-header-height calculation when appropriate.
  • Removes <dds-table-of-contents> in the horizontal orientation from --dds-sticky-header-height calculation until it is sticking to the top of the viewport.
  • Fixes incorrectly named properties related to <dds-leadspace-with-search>, allowing those elements to be properly factored into calculations.

Testing Instructions

Visit the Dotcom Shell deploy preview's various Stories and verify the --dds-sticky-header-height custom property set on the root element has a value that matches the current "stuck" elements' height.

@jkaeser jkaeser added package: utilities Work necessary for the Carbon for IBM.com utilities package adopter: AEM used when component or pattern will be used by this adopter owner: Innovation Team used when the engineering work will be done by Hybrid Cloud with DDS engineers as consultants 👀 eyes needed labels Jun 26, 2023
@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Jun 26, 2023

@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Jun 26, 2023

@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Jun 26, 2023

@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Jun 26, 2023

@jkaeser jkaeser marked this pull request as ready for review June 26, 2023 20:56
@jkaeser jkaeser requested a review from a team as a code owner June 26, 2023 20:56
@@ -114,7 +114,7 @@ class StickyHeader {
const leadspaceSearchBar = component.shadowRoot.querySelector(
`.${prefix}--search-container`
);
this._leadspaceWithSearchBar = leadspaceSearchBar;
this._leadspaceSearchBar = leadspaceSearchBar;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This and the following similar change was done to match the name of the property defined in this class's constructor.

@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Jun 26, 2023

@andy-blum
Copy link
Contributor

We should probably update the storybook story that helps demo this utility. Can we add a knob to add the L1 menu?

https://ibmdotcom-webcomponents.s3.us-east.cloud-object-storage.appdomain.cloud/deploy-previews/10605/index.html?path=/story/components-dotcom-shell--without-shell

@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Jun 27, 2023

@jkaeser
Copy link
Contributor Author

jkaeser commented Jun 27, 2023

We should probably update the storybook story that helps demo this utility. Can we add a knob to add the L1 menu?

https://ibmdotcom-webcomponents.s3.us-east.cloud-object-storage.appdomain.cloud/deploy-previews/10605/index.html?path=/story/components-dotcom-shell--without-shell

@andy-blum Looks like we have a knob for that already.

Screen Shot 2023-06-27 at 9 50 18 AM

@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Jun 27, 2023

Copy link
Contributor

@m4olivei m4olivei left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@ariellalgilmore ariellalgilmore left a comment

Choose a reason for hiding this comment

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

LGTM!

@andy-blum andy-blum added the Ready to merge Label for the pull requests that are ready to merge label Jul 7, 2023
@kodiakhq kodiakhq bot merged commit b3963b6 into carbon-design-system:main Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adopter: AEM used when component or pattern will be used by this adopter 👀 eyes needed owner: Innovation Team used when the engineering work will be done by Hybrid Cloud with DDS engineers as consultants package: utilities Work necessary for the Carbon for IBM.com utilities package Ready to merge Label for the pull requests that are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants