Skip to content

Commit 75cb2d5

Browse files
authored
feat(dropdown): optional stuck addition item
When using a search dropdown, having allowAdditions activated and hideAdditions disabled, every time the user types something in the input, it is prepended in the menu. Perhaps, in some cases, the user may not be aware that he has an addition option in the dropdown to click on : there is no value selected yet in the dropdown. The user clicks on it, scrolls down, begins to type something, but there is so much results shown in the menu that the first line with the addition message displayed isn't shown there is a value selected in the dropdown. The user clicks on it, and the value is displayed within the menu, but it is like the 50th element on 100. The scrollbar is half way. The user begins to type something else, and it doesn't show the first line with the addition message It is even more remarkable if fullTextSearch equals true, a fuzzy search could display a lof of results while typing an addition. If the user isn't used to that option, he may miss it or don't fully understand this option. To activate this in dropdown, one has to add `className: {addition: 'stuck addition'}`
1 parent 4585cd0 commit 75cb2d5

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/definitions/modules/dropdown.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,16 @@ select.ui.dropdown {
572572
display: none;
573573
}
574574

575+
/* User addition item */
576+
.ui.dropdown > .menu > .stuck.addition.item:first-child {
577+
position: -webkit-sticky;
578+
position: sticky;
579+
top: 0;
580+
box-shadow: @selectionVisibleBoxShadow;
581+
background: @menuBackground;
582+
z-index: @additionZIndex;
583+
}
584+
575585
/* Hover */
576586
.ui.selection.dropdown:hover {
577587
border-color: @selectionHoverBorderColor;

src/themes/default/modules/dropdown.variables

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@
287287
States
288288
--------------------*/
289289

290+
/* Addition */
291+
@additionZIndex: @hoveredZIndex + 1;
292+
290293
/* Hovered */
291294
@hoveredItemBackground: @transparentBlack;
292295
@hoveredItemColor: @selectedTextColor;

0 commit comments

Comments
 (0)