Skip to content

Commit 28ec369

Browse files
committed
Organize imports
1 parent dff11a5 commit 28ec369

3 files changed

Lines changed: 30 additions & 12 deletions

File tree

src/includes/vscode-select/vscode-select-base.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import {
66
state,
77
} from 'lit/decorators.js';
88
import {classMap} from 'lit/directives/class-map.js';
9+
import {ifDefined} from 'lit/directives/if-defined.js';
910
import {repeat} from 'lit/directives/repeat.js';
1011
import '../../vscode-button/index.js';
1112
import '../../vscode-option/index.js';
1213
import {VscodeOption} from '../../vscode-option/index.js';
13-
import type {InternalOption, Option, FilterMethod} from './types.js';
14-
import {filterOptionsByPattern, highlightRanges} from './helpers.js';
1514
import {VscElement} from '../VscElement.js';
15+
import {filterOptionsByPattern, highlightRanges} from './helpers.js';
1616
import {chevronDownIcon} from './template-elements.js';
17-
import {ifDefined} from 'lit/directives/if-defined.js';
17+
import type {InternalOption, Option, FilterMethod} from './types.js';
1818
import {OptionListController} from './OptionListController.js';
1919

2020
export const VISIBLE_OPTS = 10;

src/vscode-multi-select/vscode-multi-select.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {html, LitElement, nothing, TemplateResult} from 'lit';
22
import {property, query} from 'lit/decorators.js';
3+
import {ifDefined} from 'lit/directives/if-defined.js';
34
import {customElement} from '../includes/VscElement.js';
45
import {chevronDownIcon} from '../includes/vscode-select/template-elements.js';
56
import {VscodeSelectBase} from '../includes/vscode-select/vscode-select-base.js';
@@ -325,13 +326,21 @@ export class VscodeMultiSelect
325326
private _renderLabel() {
326327
switch (this._opts.selectedIndexes.length) {
327328
case 0:
328-
return html`<span class="select-face-badge no-item"
329-
>No items selected</span
329+
return html`<span
330+
class="select-face-badge no-item"
331+
aria-label="Click to open the list of items"
332+
>0 selected</span
330333
>`;
331334
case 1:
332-
return html`<span class="select-face-badge">1 item selected</span>`;
335+
return html`<span
336+
class="select-face-badge"
337+
aria-label="Click to open the list of items"
338+
>1 item selected</span
339+
>`;
333340
default:
334-
return html`<span class="select-face-badge"
341+
return html`<span
342+
class="select-face-badge"
343+
aria-label="Click to open the list of items"
335344
>${this._opts.selectedIndexes.length} items selected</span
336345
>`;
337346
}
@@ -340,13 +349,19 @@ export class VscodeMultiSelect
340349
protected override _renderSelectFace(): TemplateResult {
341350
const activeDescendant =
342351
this._opts.activeIndex > -1 ? `op-${this._opts.activeIndex}` : '';
352+
const expanded = this.open ? 'true' : 'false';
343353

344354
return html`
345355
<div
346-
aria-activedescendant=${activeDescendant}
356+
aria-activedescendant=${ifDefined(
357+
this._opts.multiSelect ? undefined : activeDescendant
358+
)}
347359
aria-controls="select-listbox"
348-
aria-expanded=${this.open ? 'true' : 'false'}
360+
aria-expanded=${ifDefined(
361+
this._opts.multiSelect ? undefined : expanded
362+
)}
349363
aria-haspopup="listbox"
364+
aria-label=${ifDefined(this.label ?? undefined)}
350365
class="select-face face multiselect"
351366
@click=${this._onFaceClick}
352367
.tabIndex=${this.disabled ? -1 : 0}
@@ -390,7 +405,10 @@ export class VscodeMultiSelect
390405

391406
override render(): TemplateResult {
392407
return html`
393-
<div class="multi-select">
408+
<div
409+
class="multi-select"
410+
aria-label=${ifDefined(this.label ?? undefined)}
411+
>
394412
<slot class="main-slot" @slotchange=${this._onSlotChange}></slot>
395413
${this.combobox ? this._renderComboboxFace() : this._renderSelectFace()}
396414
${this._renderDropdown()}

src/vscode-single-select/vscode-single-select.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import {html, LitElement, TemplateResult} from 'lit';
22
import {property, query} from 'lit/decorators.js';
3+
import {ifDefined} from 'lit/directives/if-defined.js';
34
import {customElement} from '../includes/VscElement.js';
45
import {chevronDownIcon} from '../includes/vscode-select/template-elements.js';
56
import {VscodeSelectBase} from '../includes/vscode-select/vscode-select-base.js';
6-
import styles from './vscode-single-select.styles.js';
77
import {AssociatedFormControl} from '../includes/AssociatedFormControl.js';
8-
import {ifDefined} from 'lit/directives/if-defined.js';
8+
import styles from './vscode-single-select.styles.js';
99

1010
export type VscSingleSelectCreateOptionEvent = CustomEvent<{value: string}>;
1111

0 commit comments

Comments
 (0)