@salesforcedevs/docs-components 1.3.325-rnbtab-alpha3 → 1.3.325-rnbtab-alpha4

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.325-rnbtab-alpha3",
3
+ "version": "1.3.325-rnbtab-alpha4",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -118,7 +118,9 @@ export default class ContentLayout extends LightningElement {
118
118
  updateRNB = () => {
119
119
  const headingElements = this.getHeadingElements();
120
120
  headingElements.forEach((headingElement: any) => {
121
+ // Sometimes elements hash and header is not being set when slot content is wrapped with div
121
122
  headingElement.hash = headingElement.attributes.hash?.nodeValue;
123
+ headingElement.header = headingElement.attributes.header?.nodeValue;
122
124
  });
123
125
  this.updateTocItems(headingElements);
124
126
  };
@@ -147,7 +149,8 @@ export default class ContentLayout extends LightningElement {
147
149
  if (tab?.getAttribute("aria-selected") === "true") {
148
150
  const tabID = tab?.getAttribute("aria-label");
149
151
  const url = new URL(window.location.href);
150
- if (url.searchParams.get("type") !== tabID) {
152
+ const selectedTabId = this.getSelectedTabId();
153
+ if (selectedTabId !== tabID) {
151
154
  url.searchParams.set("type", tabID);
152
155
  url.hash = "";
153
156
  window.history.pushState({}, "", url.toString());
@@ -211,10 +214,14 @@ export default class ContentLayout extends LightningElement {
211
214
  }
212
215
  }
213
216
 
214
- private restoreTabSelection() {
217
+ private getSelectedTabId() {
215
218
  const urlParams = new URLSearchParams(window.location.search);
216
219
  const selectedTabId = urlParams.get("type");
220
+ return selectedTabId;
221
+ }
217
222
 
223
+ private restoreTabSelection() {
224
+ const selectedTabId = this.getSelectedTabId();
218
225
  if (selectedTabId) {
219
226
  this.selectTabById(selectedTabId);
220
227
  }