Skip to content

feat: a11y completion + AbortSignal + grouped options (v3.2.0) - #3

Merged
michaeljfalk merged 1 commit into
mainfrom
feat/3.2.0-a11y-abort-groups
Jun 17, 2026
Merged

michaeljfalk merged 1 commit into
mainfrom
feat/3.2.0-a11y-abort-groups

Conversation

@michaeljfalk

Copy link
Copy Markdown
Owner

Summary

Tier 1 of the agreed roadmap — three additive features, no breaking changes.

1. Accessibility (ARIA combobox/listbox pattern)

  • Options get stable ids; the active row carries aria-selected="true" and is referenced by the input's aria-activedescendant (so arrow-key nav is announced).
  • Input gains aria-controls (→ menu) and aria-haspopup="listbox".
  • A visually-hidden aria-live="polite" region announces result counts, "Searching…", and the no-matches/create state.

2. AbortSignal for async sources

  • Async source ctx now includes a real signal → { scope, limit, query, signal }.
  • A newer search aborts the previous one's signal; remoteSource passes it to fetch; destroy() aborts in-flight too.
  • Fixes a doc/code mismatch: signal was documented on line 27 but never actually provided.

3. Grouped options

  • groupBy(option) => string function or per-option group field → <optgroup>-style headings (.liveselect__group).
  • Results are stably reordered so same-group items sit together (first-seen group order), so sources needn't pre-sort. activeIndex/keyboard nav stay consistent with the reordered list.

Changes

  • dist/liveselect.js — a11y wiring, AbortController per search, _group/_groupOf/_announce helpers, group field in normalizeOption, remoteSource passes signal
  • dist/liveselect.css — .liveselect__group heading style
  • test/client.test.js — 4 new tests (a11y ids/activedescendant/live-region, abort-on-supersede, grouping reorder, groupBy precedence) → 30/30 pass
  • README.md — Grouped options + Accessibility sections, options-table rows, async-ctx note, Features bullet
  • examples/vanilla.html — grouped-options demo (section 5)
  • CHANGELOG.md + package.json — bump to 3.2.0

Test plan

  • npm test → 30/30 (was 26); existing XSS/escaping regressions still pass
  • Core + example inline script both parse clean

🤖 Generated with Claude Code

… — v3.2.0

Tier 1 of the feature roadmap:

- Accessibility: ARIA combobox/listbox pattern. Options get stable ids; active
  row gets aria-selected and is referenced by the input's aria-activedescendant;
  input gains aria-controls/aria-haspopup; a visually-hidden aria-live region
  announces result counts, "Searching…", and the no-matches/create state.
- AbortSignal: async source ctx now carries a real `signal` (a newer search
  aborts the previous; remoteSource passes it to fetch; destroy() aborts too).
  Fixes the doc/code mismatch where `signal` was documented but never provided.
- Grouped options: groupBy(option) fn or per-option `group` field render
  optgroup-style headings (.liveselect__group); results stably reordered.

Includes 4 new jsdom tests (30 total), CSS for group headings, README sections
(Grouped options, Accessibility) + options-table rows, a grouped-options demo in
examples/vanilla.html, and CHANGELOG/version bump to 3.2.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@michaeljfalk
michaeljfalk merged commit b276e63 into main Jun 17, 2026
1 check passed
@michaeljfalk
michaeljfalk deleted the feat/3.2.0-a11y-abort-groups branch June 17, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant