diff --git a/.changeset/rh-navigation-secondary-slot.md b/.changeset/rh-navigation-secondary-slot.md new file mode 100644 index 0000000000..2fe5ac7ce4 --- /dev/null +++ b/.changeset/rh-navigation-secondary-slot.md @@ -0,0 +1,4 @@ +--- +"@rhds/elements": patch +--- +``: fix unclosed `cta` slot tag diff --git a/elements/rh-navigation-secondary/rh-navigation-secondary.ts b/elements/rh-navigation-secondary/rh-navigation-secondary.ts index 99ab35a54c..7f54a5a2ce 100644 --- a/elements/rh-navigation-secondary/rh-navigation-secondary.ts +++ b/elements/rh-navigation-secondary/rh-navigation-secondary.ts @@ -154,12 +154,12 @@ export class RhNavigationSecondary extends LitElement {
- +
@@ -171,32 +171,6 @@ export class RhNavigationSecondary extends LitElement { `; } - /** - * Public API, opens a specific dropdown based on index. - * Closes all open dropdowns before opening specified. - * Toggles overlay to open - */ - open(index: number): void { - if (index == null) { - return; - } - const dropdown = this.#dropdownByIndex(index); - if (dropdown && RhNavigationSecondary.isDropdown(dropdown)) { - this.close(); - this.#expand(index); - dropdown?.querySelector('a')?.focus(); - this.overlayOpen = true; - } - } - - /** - * Public API, closes all open dropdowns - */ - close(): void { - const dropdowns = this.#allDropdowns(); - dropdowns.forEach(dropdown => this.#closeDropdown(dropdown)); - } - /** * When dropdown event is triggered gets dropdown index that triggered * event then closes all dropdowns. @@ -374,6 +348,32 @@ export class RhNavigationSecondary extends LitElement { this.mobileMenuExpanded = !this.mobileMenuExpanded; this.dispatchEvent(new SecondaryNavOverlayChangeEvent(this.mobileMenuExpanded, this)); } + + /** + * Opens a specific dropdown based on index. + * Closes all open dropdowns before opening specified. + * Toggles overlay to open + */ + public open(index: number): void { + if (index != null) { + const dropdown = this.#dropdownByIndex(index); + if (dropdown && RhNavigationSecondary.isDropdown(dropdown)) { + this.close(); + this.#expand(index); + dropdown?.querySelector('a')?.focus(); + this.overlayOpen = true; + } + } + } + + /** + * Closes all open dropdowns + */ + public close(): void { + this.#allDropdowns() + .forEach(dropdown => + this.#closeDropdown(dropdown)); + } } @customElement('rh-secondary-nav')