Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 53175ad

Browse files
devversionThomasBurleson
authored andcommitted
fix(select): remove checkbox container for label element
* Currently the checkbox container for multiple options is copied to the label element, which caused the options to wrap inside of the label. The checkbox containers should be removed as well as the ripple container. Fixes #8726. Closes #8729
1 parent c8821eb commit 53175ad

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/components/select/select.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,21 @@ function SelectMenuDirective($parse, $mdUtil, $mdTheming) {
722722
// container remove it from the HTML string, before returning the string.
723723
mapFn = function(el) {
724724
var html = el.innerHTML;
725+
725726
// Remove the ripple container from the selected option, copying it would cause a CSP violation.
726727
var rippleContainer = el.querySelector('.md-ripple-container');
727-
return rippleContainer ? html.replace(rippleContainer.outerHTML, '') : html;
728+
if (rippleContainer) {
729+
html = html.replace(rippleContainer.outerHTML, '');
730+
}
731+
732+
// Remove the checkbox container, because it will cause the label to wrap inside of the placeholder.
733+
// It should be not displayed inside of the label element.
734+
var checkboxContainer = el.querySelector('._md-container');
735+
if (checkboxContainer) {
736+
html = html.replace(checkboxContainer.outerHTML, '');
737+
}
738+
739+
return html;
728740
};
729741
} else if (mode == 'aria') {
730742
mapFn = function(el) { return el.hasAttribute('aria-label') ? el.getAttribute('aria-label') : el.textContent; };

0 commit comments

Comments
 (0)