Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 145217c

Browse files
chore(select): Remove multi-select from mdc-select. (#1917)
BREAKING CHANGE: Removes mdc-multi-select from the mdc-select package. Use lists to create components that allow multiple items to be selected.
1 parent da34cc9 commit 145217c

File tree

3 files changed

+20
-145
lines changed

3 files changed

+20
-145
lines changed

demos/select.html

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -151,25 +151,25 @@ <h2 class="mdc-typography--title">CSS Only</h2>
151151
</div>
152152
</section>
153153

154-
<section class="example">
155-
<h2>Select Multiple - CSS Only</h2>
156-
<select multiple size="8" class="mdc-multi-select mdc-list">
157-
158-
<optgroup class="mdc-list-group" label="Fats, Oils, &amp; Sweets">
159-
<option class="mdc-list-item">Olive Oil</option>
160-
<option class="mdc-list-item">Brown Sugar</option>
161-
<option class="mdc-list-item">Ice Cream</option>
162-
</optgroup>
163-
<option class="mdc-list-divider" role="presentation" disabled />
164-
165-
<optgroup class="mdc-list-group" label="Dairy">
166-
<option class="mdc-list-item">Milk</option>
167-
<option class="mdc-list-item">Cheese</option>
168-
<option class="mdc-list-item">More Cheese</option>
169-
</optgroup>
170-
171-
</select>
172-
</section>
154+
<!--<section class="example">-->
155+
<!--<h2>Select Multiple - CSS Only</h2>-->
156+
<!--<select multiple size="8" class="mdc-multi-select mdc-list">-->
157+
158+
<!--<optgroup class="mdc-list-group" label="Fats, Oils, &amp; Sweets">-->
159+
<!--<option class="mdc-list-item">Olive Oil</option>-->
160+
<!--<option class="mdc-list-item">Brown Sugar</option>-->
161+
<!--<option class="mdc-list-item">Ice Cream</option>-->
162+
<!--</optgroup>-->
163+
<!--<option class="mdc-list-divider" role="presentation" disabled />-->
164+
165+
<!--<optgroup class="mdc-list-group" label="Dairy">-->
166+
<!--<option class="mdc-list-item">Milk</option>-->
167+
<!--<option class="mdc-list-item">Cheese</option>-->
168+
<!--<option class="mdc-list-item">More Cheese</option>-->
169+
<!--</optgroup>-->
170+
171+
<!--</select>-->
172+
<!--</section>-->
173173

174174
</main>
175175
<script src="/assets/material-components-web.js"></script>

packages/mdc-select/README.md

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ path: /catalog/input-controls/select-menus/
1515
</a>
1616
</div>-->
1717

18-
MDC Select provides Material Design single-option and multi-option select menus. It functions analogously to the
18+
MDC Select provides Material Design single-option select menus. It functions analogously to the
1919
browser's native `<select>` element, and includes a gracefully degraded version that can be used
2020
in conjunction with the browser's native element. Both are fully accessible, and fully RTL-aware.
2121

@@ -226,38 +226,6 @@ E.g.:
226226
</div>
227227
```
228228

229-
### Multi Select
230-
231-
MDC-Web implements multi-select on top of the `<select multiple>` element.
232-
233-
```html
234-
<select multiple size="6" class="mdc-multi-select mdc-list" >
235-
<optgroup class="mdc-list-group" label="Starches">
236-
<option class="mdc-list-item">
237-
Potato
238-
</option>
239-
<option class="mdc-list-item">
240-
Cereal
241-
</option>
242-
</optgroup>
243-
<option class="mdc-list-divider" role="presentation" disabled />
244-
<option>
245-
misc...
246-
</option>
247-
</select>
248-
```
249-
250-
Select elements take a `size` attribute to determine the height of the select box.
251-
252-
If you'd like to maintain the width or height outside of the attribute, you'll need to set it in your styles:
253-
254-
```css
255-
.my-select-container .mdc-select {
256-
width: 300px;
257-
height: 550px;
258-
}
259-
```
260-
261229
#### Classes
262230

263231
| Class | Description |

packages/mdc-select/mdc-select.scss

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -297,99 +297,6 @@ $mdc-select-menu-transition: transform 180ms $mdc-animation-standard-curve-timin
297297
}
298298
}
299299

300-
// postcss-bem-linter: define multi-select
301-
.mdc-multi-select {
302-
@include mdc-theme-prop(border-color, text-hint-on-light);
303-
304-
width: 250px;
305-
padding: 0;
306-
border-width: 1px;
307-
border-style: solid;
308-
outline: none;
309-
appearance: none;
310-
311-
@include mdc-theme-dark {
312-
@include mdc-theme-prop(border-color, text-hint-on-dark);
313-
}
314-
315-
// stylelint-disable plugin/selector-bem-pattern
316-
.mdc-list-group {
317-
@include mdc-theme-prop(color, text-hint-on-light);
318-
319-
margin: 16px 0 0;
320-
padding: 0 0 0 16px;
321-
font-weight: normal;
322-
323-
@include mdc-theme-dark {
324-
@include mdc-theme-prop(color, text-hint-on-dark);
325-
}
326-
327-
&:last-child {
328-
margin-bottom: 16px;
329-
}
330-
331-
.mdc-list-divider {
332-
margin-left: -16px;
333-
}
334-
// stylelint-enable plugin/selector-bem-pattern
335-
}
336-
337-
// stylelint-disable plugin/selector-bem-pattern
338-
.mdc-list-item {
339-
@include mdc-theme-prop(color, text-primary-on-light);
340-
341-
margin: 0 0 0 -16px;
342-
padding: 0 16px;
343-
344-
@include mdc-theme-dark {
345-
@include mdc-theme-prop(color, text-primary-on-dark);
346-
}
347-
348-
&:first-child {
349-
margin-top: 12px;
350-
}
351-
352-
&:last-child {
353-
margin-bottom: 8px;
354-
}
355-
356-
// Browsers are inconsistent in what they allow us to override, and some (e.g. Chrome) don't allow overriding the
357-
// OS-determined selection color, which states styles are not going to play well with.
358-
// Additionally, Firefox seems to ignore position: relative on option elements, which causes the pseudo elements
359-
// that we use for ripple/states to position and size themselves relative to the entire body instead.
360-
// Disabling states-specific styles on multi-select options altogether is the most straightforward recourse.
361-
&::before,
362-
&::after {
363-
content: none;
364-
}
365-
}
366-
// stylelint-enable plugin/selector-bem-pattern
367-
368-
// stylelint-disable plugin/selector-bem-pattern
369-
.mdc-list-item:checked {
370-
@include mdc-theme-prop(background-color, background);
371-
372-
@include mdc-theme-dark {
373-
@include mdc-theme-prop(background-color, text-primary-on-dark);
374-
}
375-
}
376-
377-
.mdc-list-divider {
378-
margin-bottom: 8px;
379-
padding-top: 8px;
380-
font-size: 0;
381-
}
382-
// stylelint-enable plugin/selector-bem-pattern
383-
}
384-
385-
.mdc-multi-select:focus .mdc-list-item:checked {
386-
@include mdc-theme-prop(background-color, primary);
387-
388-
@include mdc-theme-dark {
389-
@include mdc-theme-prop(background-color, text-primary-on-dark);
390-
}
391-
}
392-
393300
// height for option elements cannot be controlled
394301
// with CSS. Use the font-size rule instead.
395302

0 commit comments

Comments
 (0)