Skip to content

Commit

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

# Backport

This will backport the following commits from `main` to `8.x`:
- [fix: [Security:Rules:SharedExceptionList] The toggle button for
linking a rule on add rule exception panel is missing discernible text
(#205600)](#205600)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Alexey
Antonov","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-22T08:23:13Z","message":"fix:
[Security:Rules:SharedExceptionList] The toggle button for linking a
rule on add rule exception panel is missing discernible text
(#205600)\n\nCloses: #204667\r\n\r\n## Summary\r\nThe toggle button for
linking to a rule on Add rule exception panel is\r\nmissing discernible
text\r\n**Preconditions**\r\nSecurity -> Rules->Shared exceptions ->Add
rule exception panel is open\r\n\r\n## Changes made: \r\n1. Added
'label' attribute for **EuiSwitch**\r\n\r\n###
Screen\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/9714112b-b402-43c6-9b62-388f94079b33)","sha":"a878c98ecc312ff7192698cde6afd38060c124b8","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Project:Accessibility","release_note:skip","v9.0.0","Team:
SecuritySolution","backport:prev-minor"],"title":"fix:
[Security:Rules:SharedExceptionList] The toggle button for linking a
rule on add rule exception panel is missing discernible
text","number":205600,"url":"https://github.com/elastic/kibana/pull/205600","mergeCommit":{"message":"fix:
[Security:Rules:SharedExceptionList] The toggle button for linking a
rule on add rule exception panel is missing discernible text
(#205600)\n\nCloses: #204667\r\n\r\n## Summary\r\nThe toggle button for
linking to a rule on Add rule exception panel is\r\nmissing discernible
text\r\n**Preconditions**\r\nSecurity -> Rules->Shared exceptions ->Add
rule exception panel is open\r\n\r\n## Changes made: \r\n1. Added
'label' attribute for **EuiSwitch**\r\n\r\n###
Screen\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/9714112b-b402-43c6-9b62-388f94079b33)","sha":"a878c98ecc312ff7192698cde6afd38060c124b8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/205600","number":205600,"mergeCommit":{"message":"fix:
[Security:Rules:SharedExceptionList] The toggle button for linking a
rule on add rule exception panel is missing discernible text
(#205600)\n\nCloses: #204667\r\n\r\n## Summary\r\nThe toggle button for
linking to a rule on Add rule exception panel is\r\nmissing discernible
text\r\n**Preconditions**\r\nSecurity -> Rules->Shared exceptions ->Add
rule exception panel is open\r\n\r\n## Changes made: \r\n1. Added
'label' attribute for **EuiSwitch**\r\n\r\n###
Screen\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/9714112b-b402-43c6-9b62-388f94079b33)","sha":"a878c98ecc312ff7192698cde6afd38060c124b8"}}]}]
BACKPORT-->

Co-authored-by: Alexey Antonov <[email protected]>
  • Loading branch information
kibanamachine and alexwizp authored Jan 22, 2025
1 parent 8e02172 commit 6250109
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 6250109

Please sign in to comment.