forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [Rules > Detection rules][AXE-CORE]: Buttons must have discernib…
…le text (elastic#177273) Closes: elastic/security-team#8566 Closes: elastic/security-team#8569 ## Description The `<RuleSwitch />` component is currently flagged by the axe browser plugin for lacking text or an accessible label in its button switch. This pull request introduces support for the addition of the `aria-label` attribute to address this issue. Additionally, adjustments are made in two instances where this component is utilized within the codebase. ## Screens ### Axe report ![image](https://github.com/elastic/kibana/assets/20072247/36287d4f-fd98-4b26-b313-a39a72aefb81) ### A11y label ![image](https://github.com/elastic/kibana/assets/20072247/c61c9d0d-dd6e-4af2-9d43-04e86ad21954)
- Loading branch information
Showing
5 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
.../plugins/security_solution/public/detections/components/rules/rule_switch/translations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* 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 ruleSwitchAriaLabel = (name: string, isActive: boolean) => | ||
i18n.translate('xpack.securitySolution.ruleDetails.ruleSwitch.ariaLabel', { | ||
values: { | ||
name, | ||
action: isActive | ||
? i18n.translate('xpack.securitySolution.ruleDetails.ruleSwitch.ariaLabel.switchOff', { | ||
defaultMessage: 'Switch off', | ||
}) | ||
: i18n.translate('xpack.securitySolution.ruleDetails.ruleSwitch.ariaLabel.switchOn', { | ||
defaultMessage: 'Switch on', | ||
}), | ||
}, | ||
defaultMessage: '{action} "{name}"', | ||
}); |