@cagovweb/state-template 6.3.1-beta6 → 6.3.1-beta8

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.
@@ -1,4 +1,4 @@
1
- var StateTemplateNpmPackageVersion="6.3.1-beta6";
1
+ var StateTemplateNpmPackageVersion="6.3.1-beta8";
2
2
  /*!
3
3
  * Bootstrap v5.3.0 (https://getbootstrap.com/)
4
4
  * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
@@ -8751,6 +8751,13 @@ window.addEventListener("load", () => {
8751
8751
  )
8752
8752
  );
8753
8753
 
8754
+ const getAllFirstLevelNavLinks = () =>
8755
+ /** @type { NodeListOf<HTMLElement>} */ (
8756
+ navSearchCont.querySelectorAll(
8757
+ "a.first-level-link, button.first-level-btn"
8758
+ )
8759
+ );
8760
+
8754
8761
  // Escape key event listener
8755
8762
  document.addEventListener("keydown", e => {
8756
8763
  if (navSearchCont.classList.contains("visible")) {
@@ -8814,12 +8821,16 @@ window.addEventListener("load", () => {
8814
8821
 
8815
8822
  // Button click close menu function
8816
8823
  const closeMenu = () => {
8817
- navSearchCont.classList.remove("visible");
8824
+ if (navSearchCont.classList.contains("visible")) {
8825
+ navSearchCont.classList.remove("visible");
8826
+
8827
+ //Set focus only when close actually happens
8828
+ navToggleBtn.focus();
8829
+ }
8830
+
8818
8831
  navSearchCont.classList.add("not-visible");
8819
8832
 
8820
8833
  setClosed();
8821
-
8822
- navToggleBtn.focus();
8823
8834
  };
8824
8835
 
8825
8836
  const setClosed = () => {
@@ -8846,11 +8857,16 @@ window.addEventListener("load", () => {
8846
8857
  navMobileMenuToggleBtn.addEventListener("click", closeMenu);
8847
8858
 
8848
8859
  const mobileCheck = () => {
8849
- closeMenu();
8850
- if (mobileControlsDisplay !== "block") {
8851
- // desktop
8860
+ NavReset();
8852
8861
 
8853
- NavReset();
8862
+ // desktop
8863
+ if (isDesktopWidth()) {
8864
+ getAllFirstLevelNavLinks().forEach(el => el.removeAttribute("tabindex"));
8865
+ }
8866
+ // mobile
8867
+ else {
8868
+ getAllFirstLevelNavLinks().forEach(el => (el.tabIndex = -1));
8869
+ closeMenu();
8854
8870
  }
8855
8871
  };
8856
8872