Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Observability Onboarding] Add ARIA labels to option containers on the main screen #190707

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export const OnboardingFlowForm: FunctionComponent = () => {

const customMargin = useCustomMargin();
const radioGroupId = useGeneratedHtmlId({ prefix: 'onboardingCategory' });
const categorySelectorTitleId = useGeneratedHtmlId();
const packageListTitleId = useGeneratedHtmlId();

const [searchParams, setSearchParams] = useSearchParams();

Expand Down Expand Up @@ -138,6 +140,7 @@ export const OnboardingFlowForm: FunctionComponent = () => {
return (
<EuiPanel hasBorder paddingSize="xl">
<TitleWithIcon
id={categorySelectorTitleId}
iconType="createSingleMetricJob"
title={i18n.translate(
'xpack.observability_onboarding.experimentalOnboardingFlow.strong.startCollectingYourDataLabel',
Expand All @@ -147,7 +150,13 @@ export const OnboardingFlowForm: FunctionComponent = () => {
)}
/>
<EuiSpacer size="m" />
<EuiFlexGroup css={{ ...customMargin, maxWidth: '560px' }} gutterSize="l" direction="column">
<EuiFlexGroup
css={{ ...customMargin, maxWidth: '560px' }}
gutterSize="l"
direction="column"
role="group"
aria-labelledby={categorySelectorTitleId}
>
{options.map((option) => (
<EuiFlexItem
key={option.id}
Expand All @@ -156,36 +165,7 @@ export const OnboardingFlowForm: FunctionComponent = () => {
<EuiCheckableCard
id={`${radioGroupId}_${option.id}`}
name={radioGroupId}
label={
<>
<EuiText css={{ fontWeight: 'bold' }}>{option.label}</EuiText>
<EuiSpacer size="s" />
<EuiText color="subdued" size="s">
{option.description}
</EuiText>
{(option.logos || option.showIntegrationsBadge) && (
<>
<EuiSpacer size="m" />
<EuiFlexGroup gutterSize="s" responsive={false}>
{option.logos?.map((logo) => (
<EuiFlexItem key={logo} grow={false}>
<LogoIcon logo={logo} />
</EuiFlexItem>
))}
{option.showIntegrationsBadge && (
<EuiBadge color="hollow">
<FormattedMessage
defaultMessage="+ Integrations"
id="xpack.observability_onboarding.experimentalOnboardingFlow.form.addIntegrations"
description="A badge indicating that the user can add additional observability integrations to their deployment via this option"
/>
</EuiBadge>
)}
</EuiFlexGroup>
</>
)}
</>
}
label={<EuiText css={{ fontWeight: 'bold' }}>{option.label}</EuiText>}
checked={option.id === searchParams.get('category')}
/**
* onKeyDown and onKeyUp handlers disable
Expand All @@ -211,15 +191,45 @@ export const OnboardingFlowForm: FunctionComponent = () => {
);
}
}}
/>
>
<EuiText color="subdued" size="s">
{option.description}
</EuiText>
{(option.logos || option.showIntegrationsBadge) && (
<>
<EuiSpacer size="m" />
<EuiFlexGroup gutterSize="s" responsive={false}>
{option.logos?.map((logo) => (
<EuiFlexItem key={logo} grow={false}>
<LogoIcon logo={logo} />
</EuiFlexItem>
))}
{option.showIntegrationsBadge && (
<EuiBadge color="hollow">
<FormattedMessage
defaultMessage="+ Integrations"
id="xpack.observability_onboarding.experimentalOnboardingFlow.form.addIntegrations"
description="A badge indicating that the user can add additional observability integrations to their deployment via this option"
/>
</EuiBadge>
)}
</EuiFlexGroup>
</>
)}
</EuiCheckableCard>
</EuiFlexItem>
))}
</EuiFlexGroup>
{/* Hiding element instead of not rending these elements in order to preload available packages on page load */}
<div hidden={!searchParams.get('category') || !customCards}>
<div
hidden={!searchParams.get('category') || !customCards}
role="group"
aria-labelledby={packageListTitleId}
>
<EuiSpacer />
<div ref={suggestedPackagesRef}>
<TitleWithIcon
id={packageListTitleId}
iconType="savedObjectsApp"
title={i18n.translate(
'xpack.observability_onboarding.experimentalOnboardingFlow.whatTypeOfResourceLabel',
Expand Down Expand Up @@ -265,15 +275,16 @@ export const OnboardingFlowForm: FunctionComponent = () => {
interface TitleWithIconProps {
title: string;
iconType: string;
id?: string;
}

const TitleWithIcon: FunctionComponent<TitleWithIconProps> = ({ title, iconType }) => (
const TitleWithIcon: FunctionComponent<TitleWithIconProps> = ({ title, iconType, id }) => (
<EuiFlexGroup responsive={false} gutterSize="m" alignItems="center">
<EuiFlexItem grow={false}>
<EuiAvatar size="l" name={title} iconType={iconType} iconSize="l" color="subdued" />
</EuiFlexItem>
<EuiFlexItem>
<EuiTitle size="s">
<EuiTitle size="s" id={id}>
<strong>{title}</strong>
</EuiTitle>
</EuiFlexItem>
Expand Down