mirror of
https://github.com/Choices-js/Choices.git
synced 2026-03-14 14:45:47 +01:00
12 KiB
12 KiB
Changelog
[11.0.0-rc8] (2024-08-23)
⚠ BREAKING CHANGES
- Trigger a search event (with empty value and 0 resultCount) when search stops
Features
searchResultLimitcan be set to-1for no limit of search results to display.
Bug Fixes (from 10.2.0)
- Fix edge case where aria-label could be added twice
- Fix the page scrolls when you press 'space' on a single select input #1103
- Update typescript definition for
removeActiveItemsto explicitly markexcludedIdas optional #1116
Chore
- Reduce the number of loops over choices when rendering search results, results in more compact code.
- Byte shave bundle sizes down
[11.0.0-rc7] (2024-08-19)
⚠ BREAKING CHANGES
- Improve consistency of the
choiceevent firing.choiceevent now occurs after theaddItemevent enterkey now consistently opens/closes the dropdown instead of the behavior varying depending on backing element or internal state of the highlighted choice
Features
- Add
closeDropdownOnSelectoption, controls how the dropdown is close after selection is made. #636 #973 #1012 - Allow choices.js to be imported on nodejs, useful for tests and also server side rendering. As windows.document is by default not defined, the default template rendering will not function. The
callbackOnCreateTemplatescallback must be used. #861
Bug Fixes (from 10.2.0)
- Improve various
[aria-*]attribute handling for better lighthouse accessibility scores #1169 - Improve contrast on default CSS by darkening primary item selection color #924
Bug Fixes (from 11.0.0RC6)
- Fix destroy&init of
choices.jswould lost track of data from the backing<input>/<select> - Update e2e tests
Bug Fixes (from 11.0.0RC1)
- Fix various
select-onebugs related to how<select>initializes and selected values do not match the configuredchoices.js - Fix legacy
placeholderattribute support forselect-one - Fix
data-valueattribute on choices may not be correctly rendered into html
Chore
- Switch e2e tests from
puppeteer/selenium/cypresstoplaywright - Restructure end-to-end tests so html/script blocks are co-located to improve debugability
- Enable
@typescript-eslint/explicit-function-return-typeeslint rule
[11.0.0-rc6] (2024-08-12)
⚠ BREAKING CHANGES
- Mutation APIs
setChoiceByValue/setChoices/setValuenow throw an error if the Choices instance was not initialized or multiple choices instances where initialized on the same element. Prevents bad internal states from triggering unexpected errors #1129
Features
- Improve performance of search/filtering with large number of choices.
Bug Fixes (from 10.2.0)
- Fix Choices does not accept an element from an iframe #1057
- Fix Choices was not disable in a
<fieldset disabled>#1132 - Fix
silentoption does not silence warnings about unknown options #1119 - Fix documentation that suggests duplicateItemsAllowed works with select-multiple, when it only works for text. #1123
- Fix quadratic algorithm complexity (aka O(N^2) ) when filtering/search choices.
- Fix search results could be unexpectedly unstable, and that
fuseOptions.sortFnwas effectively ignored #1106
Bug Fixes (from 11.0.0RC1)
- Fix possible empty
aria-labelgeneration on remove item button - Fix
clearChoices()did not remove the actual selection options
[11.0.0-rc5] (2024-08-08)
⚠ BREAKING CHANGES
- Update to using Fuse.js v7.0.0
- Update choices.js package to be an ES module, and use 'subpath exports' to expose multiple versions (UMD, CJS or MTS bundles).
- Provide "fuse full" (default
choices.js, ~20.36KB), or "fuse basic" (choices.search-basic.js~19.31KB) or "prefix filter" (choices.search-filter.js~15.27KB) based on how much Fuse.js is included.
Bug Fixes (from 10.2.0)
- Fix
select-oneplaceholder could ignore the non-option placeholder configuration - Remove typescript types for tests from distribution
Chore
- Reduce bundle size from ~24KB to ~20.36KB
- Switch bundler from
webpacktorollup - Switch test framework from
mochatovitest
Bug Fixes (from 11.0.0RC4)
- Fix
aria-describedbywas being assigned when it shouldn't be - Fix check to ensure search was fully enabled for multiple select mode, as this functionality is hard-coded enabled elsewhere in the code base.
[11.0.0 RC3] (2024-08-04)
⚠ BREAKING CHANGES
- For
select-oneandselect-multiple, the placeholder value is pulled fromconfig.placeholderValue="..."or<select data-placeholder="...">before attempting to extract a placeholder from the options list. #912 #567 #843
Bug Fixes (from 10.2.0)
Chore
- Update defaults for classnames to be arrays instead of strings
Bug Fixes (from 11.0.0 RC1)
- Fix
noResults/noChoicesclasses could not be set to a list of classes - Fix failing to add an item would close the dropdown
- Fix invalid css selectors being generated for configurable css class-names with multiple css classes for an element
- Fix "Press Enter to add..." would not render if the dropdown had partially matching search results
- Fix render limit would allow
select-oneto select multiple items
[11.0.0 RC2] (2024-08-03)
Bug Fixes (from 10.2.0)
- Avoid pushing a search to fuse.js which is just additional whitespace to the existing search term
Bug Fixes (from 11.0.0 RC1)
- Fix error when using backspace key after adding an item and then removing it
- Fix adding items for select boxes would not give the max item messages reliably
- Fix
destroy()/init()would not load choices from the underlying<select>as expected - Fix adding user provided choices for
select-onewould not remove the existing item and result in a select-one with multiple items set.
Chore
- Remove unused code
- Use constant enum instead of repeating strings and type information
- For test html pages, prevent a failing
fetch()from breaking the rest of the examples - Tweak
_render()loop to avoid duplicating has-changed checks
[11.0.0 RC1] (2024-08-02)
⚠ BREAKING CHANGES
allowHtmlnow defaults to false.- HTML escaping of choice/item labels should no longer double escape depending on allowHTML mode.
- Templates/text functions now escape
'characters for display. addItemText/uniqueItemText/customAddItemTextare now called with thevalueargument already escaped.- Typescript classes for input data vs internal working data have been adjusted resulting in the
Choice/Group/Itemtypescript classes have been renamed, and aliases left as required.
Features
config.classNamesnow accept arrays to support multiple classes. #1121 #1074 #907 #832- The original option list for the select is not destroyed, and all loaded choices are serialised to HTML for better compatibility with external javascript. #1053 #1023
- New
singleModeForMultiSelectfeature to treat aselect-singleas if it was aselect-multiplewith a max item count of1, and still auto-close the dropdown and swap the active item on selection. #1136 #904 Remove item textcan be localized.- Allow user-created choices for selects. #1117 #1114
- User input is escaped by default. At the risk of XSS attacks this can be disabled by
allowHtmlUserInput.
- User input is escaped by default. At the risk of XSS attacks this can be disabled by
- Render options without a group even if groups are present. #615 #1110
- Read
data-labelclass/data-label-descriptionfrom<option>HTML to drive adding a per-choice CSS label and description text whenallowHtml: false. - Add
removeItemButtonAlignLeftoption, to control if the remove item button is at the start or the end of the item. - Add
removeChoicemethod. Removes the choice from thechoices.jsobject and any backing<option>HTML element - Add
refreshmethod. Reloads choices from the backing<select>s options. - Improve rendering performance by batching changes.
escapeForTemplatefunction is passed to the 2nd method of thecallbackOnCreateTemplatescallback.- When
allowHtmlis false, default templates now render escaped html toinnerHtmlwriting toinnerText.- This provides consistent rendering performance as
innerTextis quirky and slower than escaped html intoinnerHtml
- This provides consistent rendering performance as
- Shadow DOM support #938
Bug Fixes
- Replace malicious polyfill with cdnjs. #1161
- Maintain groups in search mode. #1152
- Fix various "first press" bugs on single select dropdowns. #1104
- Fix 'esc' would close the dropdown and also apply to the container resulting in an overlay/modal unexpectedly closing. #1039
- Fix form reset would clear the choices list, but not clear the search bar. #1023
- Fix options would be disabled when choices.js was intialized on a disabled
<select>element. #1025 - Fix a
search_termelement to appear in form submit data. #1049 - Fix 'remove item' button would trigger the change event twice due to placeholder value being used (match html single-select). #892
- Fix optgroups are not preserved when Choices is destroyed #1055
- Fix placeholder config option would be ignored for select boxes which have blank entries.
- Fix
data-custom-propertiesattribute did not serialize to created elements as a json blob as expected. #840 #1155 #543 - Fix multi-select did not correctly resizing when a select option is selected on choices.js initialization.
- Fix clearInput function did not clear the last search.
- Fix
addItemFilterwould allow empty strings as input to be added for items. - Fix various issues with double escaping when displaying items/choices depending on allowHTML mode.
- Fix
aria-labelfor placeholders was set to the stringnull - Fix
searchEnableflag was not respected forselect-multiple#1042 - Fix poor error message when Choices is passed a string selector which fails to find the element for Choices to attach to.
Chore
- Remove
deepMergedependency.