Skip to content

Commit 1a164ad

Browse files
author
m2rt
committed
feat(select): changes from code review #15
1 parent e481a54 commit 1a164ad

8 files changed

Lines changed: 157 additions & 348 deletions

File tree

tedi/components/form/select/select.component.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
[attr.aria-expanded]="isOpen()"
7171
[attr.aria-controls]="listboxId()"
7272
[attr.aria-labelledby]="labelId()"
73-
[attr.aria-activedescendant]="focusedOptionId()"
7473
/>
7574
</div>
7675
} @else {
@@ -179,6 +178,8 @@
179178
cdkListbox
180179
[cdkListboxMultiple]="multiple()"
181180
[cdkListboxValue]="visibleSelectedValues()"
181+
[cdkListboxNavigatesDisabledOptions]="false"
182+
[cdkListboxUseActiveDescendant]="true"
182183
(cdkListboxValueChange)="handleValueChange($event)"
183184
(keydown.tab)="toggleIsOpen(true)"
184185
(keydown.escape)="toggleIsOpen(true)"
@@ -187,9 +188,7 @@
187188
@if (filteredOptions().length) {
188189
@if (multiple() && showSelectAll()) {
189190
<li
190-
[id]="getOptionId('selectAll')"
191191
class="tedi-dropdown-item"
192-
[class.tedi-dropdown-item--focused]="isOptionFocused('selectAll')"
193192
[cdkOption]="SpecialOptionControls.SELECT_ALL"
194193
>
195194
<tedi-dropdown-item-value type="checkbox" [selected]="allOptionsSelected()">
@@ -202,9 +201,7 @@
202201
@if (group.label.length > 0) {
203202
@if (multiple() && selectableGroups()) {
204203
<li
205-
[id]="getOptionId('group', undefined, group.label)"
206204
class="tedi-dropdown-item tedi-select__group-name tedi-select__group-name--selectable"
207-
[class.tedi-dropdown-item--focused]="isOptionFocused('group', undefined, group.label)"
208205
[cdkOption]="SpecialOptionControls.SELECT_GROUP + group.label"
209206
>
210207
<tedi-dropdown-item-value type="checkbox" [selected]="isGroupSelected(group.label)">
@@ -224,12 +221,10 @@
224221

225222
@for (option of group.options; track option.value; let i = $index) {
226223
<li
227-
[id]="getOptionId('option', option.value)"
228224
class="tedi-dropdown-item"
229225
[class.tedi-dropdown-item--selected]="!multiple() && isOptionSelected(option.value)"
230226
[class.tedi-dropdown-item--disabled]="option.disabled"
231227
[class.tedi-dropdown-item--custom]="optionTemplate()"
232-
[class.tedi-dropdown-item--focused]="isOptionFocused('option', option.value)"
233228
[cdkOption]="option.value"
234229
[cdkOptionDisabled]="option.disabled"
235230
>

tedi/components/form/select/select.component.scss

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,21 +187,21 @@
187187
padding: 0;
188188
margin: 0;
189189
overflow-y: auto;
190+
outline: none;
190191

191-
&:focus .cdk-option-active {
192-
color: var(--dropdown-item-hover-text);
193-
background: var(--dropdown-item-hover-background);
194-
}
192+
.tedi-dropdown-item {
193+
outline: none;
195194

196-
.tedi-dropdown-item--selected {
197-
* {
198-
color: inherit !important;
195+
&.cdk-option-active:not(.tedi-dropdown-item--disabled) {
196+
outline: var(--borders-02) solid var(--tedi-primary-500);
197+
outline-offset: calc(-1 * var(--borders-02));
199198
}
200-
}
201199

202-
.tedi-dropdown-item--focused:not(.tedi-dropdown-item--disabled) {
203-
outline: var(--borders-02) solid var(--tedi-primary-500);
204-
outline-offset: calc(-1 * var(--borders-02));
200+
&[aria-selected="true"],
201+
&.tedi-dropdown-item--selected {
202+
color: var(--dropdown-item-active-text);
203+
background: var(--dropdown-item-active-background);
204+
}
205205
}
206206
}
207207

0 commit comments

Comments
 (0)