Skip to content

Commit 8ef3b44

Browse files
CopilotL1nBrabhavyarmalexwizp
authored
[ML] Add aria-label to Anomaly score button for screen reader accessibility (elastic#266469)
The Anomaly score button in the Anomaly Explorer only announces its selection value ("Multiple") to screen readers, missing the "Anomaly score" title context. This violates WCAG SC 4.1.2 (Name, Role, Value). Fixes elastic#264988 ### Changes - Added optional `aria-label` prop to `MultiSuperSelect` component, forwarded to the inner `EuiButtonEmpty` - Passed the "Anomaly score" label as `aria-label` in `SelectSeverityUI` so assistive technology announces the full context Screen readers will now announce: *"Anomaly score, Multiple, collapsed, button"* instead of just *"Multiple, collapsed, button"*. > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `ci-stats.kibana.dev` > - Triggering command: `/home/REDACTED/.nvm/versions/node/v24.14.1/bin/node /home/REDACTED/.nvm/versions/node/v24.14.1/bin/node scripts/yarn_install_scripts.js run x86-64.so.2 0.8.2 if (a[i] &lt;` (dns block) > - Triggering command: `/home/REDACTED/.nvm/versions/node/v24.14.1/bin/node /home/REDACTED/.nvm/versions/node/v24.14.1/bin/node scripts/kbn bootstrap` (dns block) > - Triggering command: `/home/REDACTED/.nvm/versions/node/v24.14.1/bin/node node scripts/check_changes.ts dd ldd s/li��` (dns block) > - `clients3.google.com` > - Triggering command: `/home/REDACTED/work/kibana/kibana/node_modules/@moonrepo/core-linux-x64-gnu/moon /home/REDACTED/work/kibana/kibana/node_modules/@moonrepo/core-linux-x64-gnu/moon run :build-webpack ldd 0.8.2` (dns block) > - `detectportal.firefox.com` > - Triggering command: `/home/REDACTED/work/kibana/kibana/node_modules/@moonrepo/core-linux-x64-gnu/moon /home/REDACTED/work/kibana/kibana/node_modules/@moonrepo/core-linux-x64-gnu/moon run :build-webpack ldd 0.8.2` (dns block) > - `google.com` > - Triggering command: `/home/REDACTED/work/kibana/kibana/node_modules/@moonrepo/core-linux-x64-gnu/moon /home/REDACTED/work/kibana/kibana/node_modules/@moonrepo/core-linux-x64-gnu/moon run :build-webpack ldd 0.8.2` (dns block) > - `googlechromelabs.github.io` > - Triggering command: `/home/REDACTED/.nvm/versions/node/v24.14.1/bin/node /home/REDACTED/.nvm/versions/node/v24.14.1/bin/node install.js _TOKEN&elastic#34;; }; f ldd b/li�� nibrowser-gtk/sys/lib/libbrotlienc.so.1.0.7` (dns block) > - `iojs.org` > - Triggering command: `/usr/bin/curl curl -q --fail --compressed -L -s REDACTED -o -` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/elastic/kibana/settings/copilot/coding_agent) (admins only) > > </details> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: L1nBra <178042654+L1nBra@users.noreply.github.com> Co-authored-by: Bhavya RM <bhavya@elastic.co> Co-authored-by: L1nBra <lina.braziulyte@gmail.com> Co-authored-by: Alexey Antonov <alexwizp@gmail.com>
1 parent 1dfe307 commit 8ef3b44

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

x-pack/platform/plugins/shared/ml/public/application/components/controls/select_severity/select_severity.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,15 @@ export const SelectSeverityUI: FC<
237237
[onChange, allSeverityOptions]
238238
);
239239

240+
const anomalyScoreLabel = i18n.translate('xpack.ml.explorer.severityThresholdLabel', {
241+
defaultMessage: 'Anomaly score',
242+
});
243+
240244
return (
241245
<div data-test-subj={'mlAnomalySeverityThresholdControls'} className={classNames}>
242246
<MultiSuperSelect
243-
prepend={i18n.translate('xpack.ml.explorer.severityThresholdLabel', {
244-
defaultMessage: 'Anomaly score',
245-
})}
247+
prepend={anomalyScoreLabel}
248+
aria-label={anomalyScoreLabel}
246249
inputDisplay={inputDisplay}
247250
options={multiSelectOptions}
248251
onOptionsChange={handleOptionsChange}

x-pack/platform/plugins/shared/ml/public/application/components/multi_super_select/multi_super_select.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ interface MultiSuperSelect<T> {
1515
inputDisplay: React.JSX.Element | string;
1616
options: Array<EuiSelectableOption<T>>;
1717
onOptionsChange?: (options: Array<EuiSelectableOption<T>>) => void;
18+
'aria-label'?: string;
1819
}
1920

2021
export const MultiSuperSelect = <T = string,>({
2122
prepend,
2223
inputDisplay,
2324
options,
2425
onOptionsChange,
26+
'aria-label': ariaLabel,
2527
}: MultiSuperSelect<T>) => {
2628
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
2729

@@ -33,7 +35,7 @@ export const MultiSuperSelect = <T = string,>({
3335

3436
const popoverButton = (
3537
<EuiFormControlLayout isDropdown prepend={prepend} compressed fullWidth>
36-
<EuiButtonEmpty onClick={onPopoverButtonClick} css={styles.control}>
38+
<EuiButtonEmpty onClick={onPopoverButtonClick} css={styles.control} aria-label={ariaLabel}>
3739
{inputDisplay}
3840
</EuiButtonEmpty>
3941
</EuiFormControlLayout>

0 commit comments

Comments
 (0)