fix: [Security:Rules:SharedExceptionList] The toggle button for linking a rule on add rule exception panel is missing discernible text (#205600)

Closes: #204667

## Summary
The toggle button for linking to a rule on Add rule exception panel is
missing discernible text
**Preconditions**
Security -> Rules->Shared exceptions ->Add rule exception panel is open

## Changes made: 
1. Added 'label' attribute for **EuiSwitch**

### Screen


![image](https://github.com/user-attachments/assets/9714112b-b402-43c6-9b62-388f94079b33)
This commit is contained in:
Alexey Antonov 2025-01-22 11:23:13 +03:00 committed by GitHub
parent e2c138bca1
commit a878c98ecc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View file

@ -8,6 +8,7 @@ import React, { memo, useCallback, useMemo } from 'react';
import type { EuiSwitchProps } from '@elastic/eui';
import { EuiFlexItem, EuiSwitch } from '@elastic/eui';
import type { RuleResponse } from '../../../../../../../common/api/detection_engine';
import * as i18n from './translations';
export const LinkRuleSwitch = memo(
({
@ -35,7 +36,12 @@ export const LinkRuleSwitch = memo(
return (
<EuiFlexItem grow={false}>
<EuiSwitch onChange={onLinkOrUnlinkRule} label="" checked={isRuleLinked} />
<EuiSwitch
onChange={onLinkOrUnlinkRule}
checked={isRuleLinked}
label={i18n.LINK_SWITCH_ARIA_LABEL(rule.name)}
showLabel={false}
/>
</EuiFlexItem>
);
}

View file

@ -0,0 +1,17 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { i18n } from '@kbn/i18n';
export const LINK_SWITCH_ARIA_LABEL = (name: string) =>
i18n.translate(
'xpack.securitySolution.rule_exceptions.flyoutComponents.addToRulesTableSelection.linkSwitch.ariaLabel',
{
values: { name },
defaultMessage: 'Link "{name}"',
}
);