Skip to content

Commit ad08d37

Browse files
authored
fix(dropdown): remove placeholderstyle when same as select text
When selecting the option from the dropdown that matches the default text value (e.g.<div class="default text">2</div>), the color of the selected value in the dropdown stays grey instead of turning black. This also applies if the value is already set (e.g. <input value="2" />). This is confusing as it states that the value has not been selected although it is. When reopening the dropdown menu the selected option is in bold and the value retrieved from the dropdown is correct. The issue is with the color not changing. And it only happens if the the option's text matches the default text. If selecting other option and then again the option matching the default text - color is black as expected.
1 parent 9bd7e11 commit ad08d37

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/definitions/modules/dropdown.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,7 +2577,7 @@ $.fn.dropdown = function(parameters) {
25772577
$menu.removeClass(className.loading);
25782578
}
25792579
},
2580-
text: function(text) {
2580+
text: function(text, isNotPlaceholder) {
25812581
if(settings.action === 'combo') {
25822582
module.debug('Changing combo button text', text, $combo);
25832583
if(settings.preserveHTML) {
@@ -2588,7 +2588,7 @@ $.fn.dropdown = function(parameters) {
25882588
}
25892589
}
25902590
else if(settings.action === 'activate') {
2591-
if(text !== module.get.placeholderText()) {
2591+
if(text !== module.get.placeholderText() || isNotPlaceholder) {
25922592
$text.removeClass(className.placeholder);
25932593
}
25942594
module.debug('Changing text', text, $text);
@@ -2836,7 +2836,7 @@ $.fn.dropdown = function(parameters) {
28362836
module.save.remoteData(selectedText, selectedValue);
28372837
}
28382838
if (!keepSearchTerm && !$selected.hasClass(className.actionable)) {
2839-
module.set.text(selectedText);
2839+
module.set.text(selectedText, true);
28402840
}
28412841
module.set.value(selectedValue, selectedText, $selected, preventChangeTrigger);
28422842
$selected

0 commit comments

Comments
 (0)