@salesforcedevs/docs-components 1.3.106-alpha.5 → 1.3.106-alpha.7

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.106-alpha.5",
3
+ "version": "1.3.106-alpha.7",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -87,7 +87,7 @@ header:not(.has-brand) > .header_l2 {
87
87
  margin-right: 0;
88
88
  padding: var(--dx-g-spacing-smd)
89
89
  var(--dx-g-global-header-padding-horizontal);
90
- height: var(--dx-g-doc-header-main-nav-height);
90
+ min-height: var(--dx-g-doc-header-main-nav-height);
91
91
  }
92
92
 
93
93
  .header_l2_group-title .header_lang-dropdown {
@@ -154,7 +154,29 @@ export default class DocXmlContent extends LightningElementWithState<{
154
154
  ));
155
155
 
156
156
  if (anchorEl) {
157
- anchorEl.scrollIntoView();
157
+ const globalNavHeader = document.querySelector(
158
+ ".global-nav-container"
159
+ ) as HTMLElement;
160
+ const docHeader = document.querySelector(
161
+ "doc-header"
162
+ ) as HTMLElement;
163
+ const headerHeight = globalNavHeader.offsetHeight;
164
+ const docHeaderHeight = docHeader.offsetHeight;
165
+ const rect = anchorEl.getBoundingClientRect();
166
+
167
+ // Calculate the scroll position required to bring the element into view
168
+ const scrollTop =
169
+ window.pageYOffset || document.documentElement.scrollTop;
170
+ const scrollX = rect.left + window.pageXOffset;
171
+ const scrollY =
172
+ rect.top + scrollTop - (headerHeight + docHeaderHeight); // subtract the header height from the top position
173
+
174
+ // Scroll to the calculated position
175
+ window.scrollTo({
176
+ top: scrollY,
177
+ left: scrollX
178
+ });
179
+
158
180
  this.setState({ internalLinkClicked: false });
159
181
  }
160
182