mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
fix: [Security:Cases] Sync alert status with case status toggle button under case settings on create case page is incorrectly announced (#205604)
Closes: #205544 ## Description When user tabs over sync alert status with case status toggle button under case settings on create case page, screenreader announces On, On switch without giving any context. ## Preconditions Security solution -> on cases page -> create case ## Changes made: 1. added context for **EuiSwitch** by passing `aria-labelledby` attribute ## Screen 
This commit is contained in:
parent
c8cd3191da
commit
efe44b2f2d
1 changed files with 4 additions and 1 deletions
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { EuiFormRow, EuiSwitch, EuiSwitchEvent } from '@elastic/eui';
|
||||
import { EuiFormRow, EuiSwitch, EuiSwitchEvent, useGeneratedHtmlId } from '@elastic/eui';
|
||||
|
||||
import { FieldHook, getFieldValidityAndErrorMessage } from '../../hook_form_lib';
|
||||
|
||||
|
@ -21,6 +21,7 @@ interface Props {
|
|||
|
||||
export const ToggleField = ({ field, euiFieldProps = {}, idAria, ...rest }: Props) => {
|
||||
const { isInvalid, errorMessage } = getFieldValidityAndErrorMessage(field);
|
||||
const formId = useGeneratedHtmlId();
|
||||
|
||||
// Shim for sufficient overlap between EuiSwitchEvent and FieldHook[onChange] event
|
||||
const onChange = (e: EuiSwitchEvent) => {
|
||||
|
@ -32,6 +33,7 @@ export const ToggleField = ({ field, euiFieldProps = {}, idAria, ...rest }: Prop
|
|||
|
||||
return (
|
||||
<EuiFormRow
|
||||
id={formId}
|
||||
helpText={field.helpText}
|
||||
error={errorMessage}
|
||||
isInvalid={isInvalid}
|
||||
|
@ -44,6 +46,7 @@ export const ToggleField = ({ field, euiFieldProps = {}, idAria, ...rest }: Prop
|
|||
checked={field.value as boolean}
|
||||
onChange={onChange}
|
||||
data-test-subj="input"
|
||||
aria-labelledby={formId}
|
||||
{...euiFieldProps}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue