forge-select 0.7.2 → 0.7.3

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/dist/index.js CHANGED
@@ -1916,13 +1916,19 @@ var ForgeSelect = class {
1916
1916
  }
1917
1917
  return false;
1918
1918
  }
1919
+ /**
1920
+ * Reads the id off the row the render pass just marked, rather than rebuilding
1921
+ * it from the highlight index. Virtual scrolling drops off-window rows, so an
1922
+ * index-derived id can name an element that no longer exists, and
1923
+ * aria-activedescendant must resolve to a real one — a dangling reference
1924
+ * reads to assistive tech as no active option at all. Keyboard navigation
1925
+ * scrolls the highlight back into view, which restores the reference.
1926
+ */
1919
1927
  updateActiveDescendant() {
1920
1928
  const target = this.searchInput ?? this.control;
1921
- if (this.highlightedIndex >= 0) {
1922
- target.setAttribute("aria-activedescendant", `${this.uid}-nav-${this.highlightedIndex}`);
1923
- } else {
1924
- target.removeAttribute("aria-activedescendant");
1925
- }
1929
+ const highlighted = this.list.querySelector(".forge-select__option--highlighted");
1930
+ if (highlighted) target.setAttribute("aria-activedescendant", highlighted.id);
1931
+ else target.removeAttribute("aria-activedescendant");
1926
1932
  }
1927
1933
  // ---------------------------------------------------------------- remote data
1928
1934
  scheduleRemoteLoad(query, delay) {