@salesforcedevs/docs-components 1.3.106-alpha.6 → 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
|
@@ -154,7 +154,29 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
154
154
|
));
|
|
155
155
|
|
|
156
156
|
if (anchorEl) {
|
|
157
|
-
|
|
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
|
|