Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/slow-buttons-stay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@db-ux/core-components": minor
"@db-ux/ngx-core-components": minor
"@db-ux/react-core-components": minor
"@db-ux/wc-core-components": minor
"@db-ux/v-core-components": minor
---

fix(DBCustomSelect): properly announce selected options
feat(DBCustomSelect): introduce new property `selectedPrefix`
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@
- status
- text: Custom Selected Label
- group:
- text: Label controlled
- text: "Selected: Label controlled"
- article:
- radiogroup "id-10aasds4-Custom Selected Label":
- list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@
- status
- text: Custom Selected Label
- group:
- text: Label controlled
- text: "Selected: Label controlled"
- article:
- radiogroup "id-10aasds4-Custom Selected Label":
- list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@
- status
- text: Custom Selected Label
- group:
- text: Label controlled
- text: "Selected: Label controlled"
- article:
- radiogroup "id-10aasds4-Custom Selected Label":
- list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@
- status
- text: Custom Selected Label
- group:
- text: Label controlled
- text: "Selected: Label controlled"
- article:
- radiogroup "id-10aasds4-Custom Selected Label":
- list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@
- status
- text: Custom Selected Label
- group:
- text: Label controlled
- text: "Selected: Label controlled"
- article:
- radiogroup "id-10aasds4-Custom Selected Label":
- list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@
- status
- text: Custom Selected Label
- group:
- text: Label controlled
- text: "Selected: Label controlled"
- article:
- radiogroup "id-10aasds4-Custom Selected Label":
- list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default function DBCustomSelect(props: DBCustomSelectProps) {
}
/* For a11y reasons we need to map the correct message with the select */
if (!selectRef?.validity.valid || props.validation === 'invalid') {
state._descByIds = state._invalidMessageId;
state.setDescById(state._invalidMessageId);
state._invalidMessage =
props.invalidMessage ||
selectRef?.validationMessage ||
Expand All @@ -157,18 +157,18 @@ export default function DBCustomSelect(props: DBCustomSelectProps) {
selectRef?.validity.valid &&
props.required
) {
state._descByIds = state._validMessageId;
state.setDescById(state._validMessageId);
if (hasVoiceOver()) {
state._voiceOverFallback =
props.validMessage ?? DEFAULT_VALID_MESSAGE;
delay(() => (state._voiceOverFallback = ''), 1000);
}
state._validity = props.validation ?? 'valid';
} else if (stringPropVisible(props.message, props.showMessage)) {
state._descByIds = state._messageId;
state.setDescById(state._messageId);
state._validity = props.validation ?? 'no-validation';
} else {
state._descByIds = state._placeholderId;
state.setDescById(state._placeholderId);
state._validity = props.validation ?? 'no-validation';
}
},
Expand Down Expand Up @@ -967,6 +967,11 @@ export default function DBCustomSelect(props: DBCustomSelectProps) {
props.selectedType === 'tag'
)}
id={state._selectedLabelsId}>
<Show when={props.selectedPrefix}>
<span data-visually-hidden="true">
{props.selectedPrefix}
</span>
</Show>
{state._selectedLabels}
</span>
</Show>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@
opacity: variables.$db-opacity-lg;
}
}

> span > span::after {
content: ": ";
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions packages/components/src/components/custom-select/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ export type DBCustomSelectDefaultProps = {
*/
selectedLabels?: string;

/**
* Optional: Prefix text announced by screen readers before the selection
* (e.g., "Ausgewählt" or "Selected").
*/
selectedPrefix?: string;

/**
* Change the selected type for values shown in multi select
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
[searchLabel]="'Search'"
[searchValue]="exampleProps?.searchValue"
[selectedLabels]="exampleProps?.selectedLabels"
[selectedPrefix]="'Selected'"
[transformSelectedLabels]="
exampleProps?.transformSelectedLabels
? getTransformSelectedLabels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const getCustomSelect = ({
values={mValue}
searchValue={searchValue}
selectedLabels={selectedLabels}
selectedPrefix="Selected"
invalidMessage={invalidMessage}
validMessage={validMessage}
validation={validation}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const getSearchFilter = (option: CustomSelectOptionType, _: string): boolean =>
searchLabel="Search"
:searchValue="exampleProps?.searchValue"
:selectedLabels="exampleProps?.selectedLabels"
selectedPrefix="Selected"
:transformSelectedLabels="
exampleProps?.transformSelectedLabels
? getTransformSelectedLabels
Expand Down