From ecba927b383efc1e0416382abbbf85eaf5d93aaf Mon Sep 17 00:00:00 2001 From: Michael Prentice Date: Wed, 16 Dec 2020 00:31:06 -0500 Subject: [PATCH] fix(select): floating label hidden w/ placeholder and no value - don't hide the floating `label` in an `md-input-container` with a `md-select` that has a `placeholder` attribute specified Fixes #10116 --- src/components/select/select.js | 33 +++++++++++++++++-------------- src/components/select/select.scss | 2 +- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/components/select/select.js b/src/components/select/select.js index 2e5f1f56b5..83a586d314 100755 --- a/src/components/select/select.js +++ b/src/components/select/select.js @@ -280,6 +280,7 @@ function SelectDirective($mdSelect, $mdUtil, $mdConstant, $mdTheming, $mdAria, $ var stopMdMultipleWatch; var userDefinedLabelledby = angular.isDefined(attrs.ariaLabelledby); var listboxContentElement = element.find('md-content'); + var initialPlaceholder = element.attr('placeholder'); if (disableAsterisk) { element.addClass('md-no-asterisk'); @@ -291,24 +292,25 @@ function SelectDirective($mdSelect, $mdUtil, $mdConstant, $mdTheming, $mdAria, $ }; if (containerCtrl.input) { - // We ignore inputs that are in the md-select-header (one - // case where this might be useful would be adding as searchbox) + // We ignore inputs that are in the md-select-header. + // One case where this might be useful would be adding as searchbox. if (element.find('md-select-header').find('input')[0] !== containerCtrl.input[0]) { - throw new Error(" can only have *one* child ,