diff --git a/packages/utilities/src/utilities/StickyHeader/StickyHeader.js b/packages/utilities/src/utilities/StickyHeader/StickyHeader.js index 5274b1d40f0..bb3d1f34124 100644 --- a/packages/utilities/src/utilities/StickyHeader/StickyHeader.js +++ b/packages/utilities/src/utilities/StickyHeader/StickyHeader.js @@ -74,21 +74,17 @@ class StickyHeader { const tocRoot = toc.shadowRoot; - const desktopSelector = `.${c4dPrefix}-ce--table-of-contents__items-container`; - + this._tableOfContentsInnerBar = tocRoot.querySelector( + `.${prefix}--tableofcontents__navbar` + ); if (window.innerWidth > gridBreakpoint) { if (toc.layout === 'horizontal') { - this._tableOfContentsInnerBar = tocRoot.querySelector( - `.${prefix}--tableofcontents__navbar` - ); this._tableOfContentsLayout = 'horizontal'; } else { - this._tableOfContentsInnerBar = tocRoot.querySelector(desktopSelector); + this._tableOfContentsInnerBar = tocRoot.querySelector( + `.${c4dPrefix}-ce--table-of-contents__items-container` + ); } - } else { - this._tableOfContentsInnerBar = tocRoot.querySelector( - `.${prefix}--tableofcontents__sidebar` - ); } }