Skip to content

Commit

Permalink
Fix group-id was not added to choices outside of search
Browse files Browse the repository at this point in the history
  • Loading branch information
Xon committed Sep 5, 2024
1 parent ccf40c3 commit 93531ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Fix regression "no choices to choose from"/"no results found" notice did not reliably trigger. [#1185](https://github.com/Choices-js/Choices/issues/1185) [#1191](https://github.com/Choices-js/Choices/issues/1191)
* Fix regression of `UnhighlightItem` event not firing [#1173](https://github.com/Choices-js/Choices/issues/1173)
* Fix `clearChoices()` would remove items, and clear the search flag.
* Fixes for opt-group handling/rendering

### Chore
* Add e2e tests for "no choices" behavior to match v10
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ const templates: TemplatesInterface = {
label = escapeForTemplate(allowHTML, label);
label += ` (${groupName})`;
label = { trusted: label };
div.dataset.groupId = `${choice.groupId}`;
}

let describedBy: HTMLElement = div;
Expand Down Expand Up @@ -308,6 +307,9 @@ const templates: TemplatesInterface = {
if (selectText) {
div.dataset.selectText = selectText;
}
if (choice.groupId) {
div.dataset.groupId = `${choice.groupId}`;
}

assignCustomProperties(div, choice, false);

Expand Down

0 comments on commit 93531ab

Please sign in to comment.