feat!: multiple selection (v4.0.0) - #5
Merged
Merged
Conversation
Headline feature: multi-select via `multiple: true`. Major version marks the
size; single-select behavior is unchanged (everything new is gated behind the
flag — no breaking changes).
- Selections render as removable chips. Add by click or type+Enter; remove via
chip × or Backspace on empty input; re-selecting a chosen row toggles it off.
- Array value throughout: getValue() → string[], getOption() → option[],
onChange(values, options), setValue([...]), change detail { value: [], options: [] }.
- maxItems caps selections (and suppresses the create row at the cap).
- submitFormat ('repeat' default | 'bracket' | 'delimited' + delimiter) controls
plain-form submission; 'repeat' mirrors native <select multiple>.
- Chosen rows get aria-selected + __opt--chosen; listbox is aria-multiselectable.
- enhance() auto-detects <select multiple>, upgrades to multi, and keeps the
original element's selected options in sync.
9 new jsdom tests (45 total), CSS for chips/chosen rows, README (Multiple
selection section, options table, Events/Instance API notes, Features bullets),
a multi-select demo in examples/vanilla.html, CHANGELOG + version bump to 4.0.0.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The headline feature: multiple selection via
multiple: true. The major version marks the size of the addition — single-select behavior is unchanged and there are no breaking changes (everything new is gated behind the flag).Multiple selection
getValue()→string[],getOption()→option[],onChange(values, options),setValue([...]), andliveselect:changedetail{ name, value: [], options: [] }.maxItemscaps selections and suppresses the create row at the cap.submitFormatcontrols plain-form submission:'repeat'(default — one hidden input per value sharing the name, exactly like native<select multiple>, so Express parsesreq.body.tagsas an array),'bracket'(name[], PHP/Rails), or'delimited'(one input joined bydelimiter).aria-selected+.liveselect__opt--chosen; the listbox isaria-multiselectable.enhance()auto-detects<select multiple>, upgrades to multi mode, and keeps the original element's selected options in sync.Changes
dist/liveselect.js—multistate; chips container + per-submitFormathidden inputs;_toggle/_deselect/_renderTags/_afterMultiChange/_syncHiddenMulti; multi branches in_select/_emit/_syncInput/_syncHidden/_syncValidity/_canCreate/getValue/getOption/setValue/clear; Backspace-to-remove; chosen-row marking;enhance()multi supportdist/liveselect.css— chips/control layout, chosen-row checkmarktest/client.test.js— 9 new tests → 45/45 passREADME.md— Multiple selection section, options table, Events/Instance API notes, Features bulletsexamples/vanilla.html— multi-select demo (section 6)CHANGELOG.md+package.json— bump to 4.0.0Test plan
npm test→ 45/45 (was 36); all single-select regressions (XSS, a11y, validation, groups, etc.) still pass🤖 Generated with Claude Code