Skip to content

Commit

Permalink
feat(dropdown): collapse on clearable optional
Browse files Browse the repository at this point in the history
Added an option collapseOnClearable to collapse the dropdown upon clicking on the clearable icon

SUI does not collapse, but FUI does, so i made this option false by default so the behavior matches SUI.
  • Loading branch information
lubber-de authored Oct 30, 2024
1 parent f3182cf commit 14bf847
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,9 @@
if (module.is.searchSelection()) {
module.remove.searchTerm();
}
module.hide();
if (settings.collapseOnClearable) {
module.hide();
}
event.stopPropagation();
},
},
Expand Down Expand Up @@ -4096,6 +4098,7 @@
headerDivider: true, // whether option headers should have an additional divider line underneath when converted from <select> <optgroup>

collapseOnActionable: true, // whether the dropdown should collapse upon selection of an actionable item
collapseOnClearable: false, // whether the dropdown should collapse upon clicking the clearable icon

// label settings on multi-select
label: {
Expand Down
6 changes: 6 additions & 0 deletions types/fomantic-ui-dropdown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,12 @@ declare namespace FomanticUI {
*/
collapseOnActionable: boolean;

/**
* Whether the dropdown should collapse upon clicking the clearable icon.
* @default false
*/
collapseOnClearable: boolean;

/**
* Allows customization of multi-select labels.
* @default true
Expand Down

0 comments on commit 14bf847

Please sign in to comment.