Skip to content

Commit

Permalink
More accesibility context for changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLuisGJ committed Nov 22, 2024
1 parent f77c706 commit b29a1f8
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export const DefaultSettingsFlyout: React.FC<DefaultSettingsFlyoutProps> = ({ cl
reduce_whitespace: reduceWhitespace,
run_ml_inference: runMLInference,
} = pipelineState;
const elementRef = useRef<HTMLAnchorElement>(null);
// Reference the first focusable element in the flyout for accessibility on click or Enter key action either Reset or Save button
const firstFocusInFlyoutRef = useRef<HTMLAnchorElement>(null);
return (
<EuiFlyout onClose={closeFlyout} size="s" paddingSize="l">
<EuiFlyoutHeader hasBorder>
Expand All @@ -82,7 +83,7 @@ export const DefaultSettingsFlyout: React.FC<DefaultSettingsFlyoutProps> = ({ cl
data-telemetry-id="entSearchContent-defaultSettingsFlyout-ingestPipelinesLink"
href={docLinks.ingestPipelines}
target="_blank"
ref={elementRef}
ref={firstFocusInFlyoutRef}
>
{i18n.translate(
'xpack.enterpriseSearch.defaultSettingsFlyout.body.description.ingestPipelinesLink.link',
Expand Down Expand Up @@ -208,7 +209,7 @@ export const DefaultSettingsFlyout: React.FC<DefaultSettingsFlyoutProps> = ({ cl
isLoading={isLoading}
onClick={() => {
setPipeline(defaultPipeline);
elementRef.current?.focus();
firstFocusInFlyoutRef.current?.focus();
}}
data-test-subj={'entSearchContentSettingsResetButton'}
>
Expand All @@ -225,7 +226,7 @@ export const DefaultSettingsFlyout: React.FC<DefaultSettingsFlyoutProps> = ({ cl
isLoading={isLoading}
onClick={() => {
makeRequest(pipelineState);
elementRef.current?.focus();
firstFocusInFlyoutRef.current?.focus();
}}
data-test-subj={'entSearchContentSettingsSaveButton'}
>
Expand Down

0 comments on commit b29a1f8

Please sign in to comment.