@salesforcedevs/docs-components 1.3.282-scroll-fix-alpha → 1.3.282-scroll-fix-alpha2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.282-scroll-fix-alpha",
3
+ "version": "1.3.282-scroll-fix-alpha2",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -385,7 +385,6 @@ mark {
385
385
  /* offset page jump link due to fixed header */
386
386
  [id] {
387
387
  scroll-margin-top: calc(
388
- var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
389
- var(--dx-g-spacing-4xl) - var(--dx-g-spacing-xs)
388
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
390
389
  );
391
390
  }
@@ -43,8 +43,7 @@ dx-toc {
43
43
  /* offset page jump link due to fixed header */
44
44
  ::slotted(doc-heading) {
45
45
  scroll-margin-top: calc(
46
- var(--dx-g-global-header-height) + var(--dx-g-doc-header-height) +
47
- var(--dx-g-spacing-4xl) - var(--dx-g-spacing-xs)
46
+ var(--dx-g-global-header-height) + var(--dx-g-doc-header-height)
48
47
  );
49
48
  }
50
49
 
@@ -231,15 +231,38 @@ export default class ContentLayout extends LightningElement {
231
231
  (globalNavEl.getBoundingClientRect().height !== 72 ? 0 : 72) +
232
232
  contextNavEl.getBoundingClientRect().height;
233
233
  const docHeaderHeight = docHeaderEl.getBoundingClientRect().height;
234
+ const totalHeaderHeight = globalNavHeight + docHeaderHeight;
235
+
236
+ const docHeadingEls = Array.from(
237
+ document.querySelectorAll("doc-heading")
238
+ );
239
+ const rightNavBarEl = this.template.querySelector(".right-nav-bar");
240
+
234
241
  sidebarEl.style.setProperty(
235
242
  "--dx-c-content-sidebar-sticky-top",
236
243
  `${globalNavHeight + docHeaderHeight}px`
237
244
  );
238
245
 
239
- docHeaderEl.style.setProperty(
240
- "--dx-g-global-header-height",
241
- `${globalNavHeight}px`
242
- );
246
+ docHeadingEls.forEach((docHeadingEl) => {
247
+ (docHeadingEl as any).style.scrollMarginTop = docPhaseEl
248
+ ? `${
249
+ totalHeaderHeight +
250
+ docPhaseEl.getBoundingClientRect().height
251
+ }px`
252
+ : `${totalHeaderHeight + 30}px`;
253
+ });
254
+
255
+ if (rightNavBarEl) {
256
+ rightNavBarEl.style.setProperty(
257
+ "--dx-c-content-sidebar-sticky-top",
258
+ docPhaseEl
259
+ ? `${
260
+ totalHeaderHeight +
261
+ docPhaseEl.getBoundingClientRect().height
262
+ }px`
263
+ : `${totalHeaderHeight}px`
264
+ );
265
+ }
243
266
 
244
267
  // If doc phase element exists, we need to account for its sticky position. Mobile should include the sidebar height (since it becomes sticky aswell).
245
268
  if (docPhaseEl) {
@@ -253,30 +276,6 @@ export default class ContentLayout extends LightningElement {
253
276
  : globalNavHeight + docHeaderHeight
254
277
  }px`
255
278
  );
256
-
257
- // Adjust scroll margin for doc headings when doc phase is present
258
- const docHeadingEls = Array.from(
259
- document.querySelectorAll("doc-heading")
260
- );
261
- docHeadingEls.forEach((docHeadingEl) => {
262
- (docHeadingEl as any).style.scrollMarginTop = `${
263
- globalNavHeight +
264
- docHeaderHeight +
265
- docPhaseEl.getBoundingClientRect().height
266
- }px`;
267
- });
268
-
269
- // Adjust right nav bar position when doc phase is present
270
- const rightNavBarEl =
271
- this.template.querySelector(".right-nav-bar");
272
-
273
- if (rightNavBarEl) {
274
- rightNavBarEl.style.top = `${
275
- globalNavHeight +
276
- docHeaderHeight +
277
- docPhaseEl.getBoundingClientRect().height
278
- }px`;
279
- }
280
279
  }
281
280
  });
282
281
  };