Skip to content

Commit

Permalink
fix: [Security:Rules:SharedExceptionList] The toggle button for linki…
Browse files Browse the repository at this point in the history
…ng a rule on add rule exception panel is missing discernible text (elastic#205600)

Closes: elastic#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)
  • Loading branch information
alexwizp authored Jan 22, 2025
1 parent e2c138b commit a878c98
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
({
Expand Down Expand Up @@ -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>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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}"',
}
);

0 comments on commit a878c98

Please sign in to comment.