Skip to content

Commit

Permalink
[Exploratory View] Disable form row for super select (#118093)
Browse files Browse the repository at this point in the history
* Disable form row for super select. The super select seems not to receive focus when clicking the form row, even when it's enabled.

* Improve report selection accessibility.

* Implement style change from PR feedback.

* Prepend label instead of expanding header size.

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
2 people authored and dmlemeshko committed Nov 29, 2021
1 parent 3d12af4 commit d0070c9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export const reportTypesList: Array<{
{ reportType: 'device-data-distribution', label: DEVICE_DISTRIBUTION_LABEL },
];

export function ReportTypesSelect() {
interface Props {
prepend: string;
}

export function ReportTypesSelect({ prepend }: Props) {
const { setReportType, reportType: selectedReportType, allSeries } = useSeriesStorage();

const onReportTypeChange = (reportType: ReportViewType) => {
Expand All @@ -52,12 +56,14 @@ export function ReportTypesSelect() {

return (
<EuiSuperSelect
aria-labelledby="report-type-label"
options={options}
valueOfSelected={selectedReportType ?? SELECT_REPORT_TYPE}
onChange={(value) => onReportTypeChange(value as ReportViewType)}
style={{ minWidth: 200 }}
isInvalid={!selectedReportType && allSeries.length > 0}
disabled={allSeries.length > 0}
prepend={prepend}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ export const SeriesEditor = React.memo(function () {
<div>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiFormRow label={REPORT_TYPE_LABEL} display="columnCompressed">
<ReportTypesSelect />
<EuiFormRow
aria-label={REPORT_TYPE_ARIA_LABEL}
id="report-type-label"
isDisabled={true}
>
<ReportTypesSelect prepend={REPORT_TYPE_LABEL} />
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem>
Expand Down Expand Up @@ -205,3 +209,10 @@ export const REPORT_TYPE_LABEL = i18n.translate(
defaultMessage: 'Report type',
}
);

export const REPORT_TYPE_ARIA_LABEL = i18n.translate(
'xpack.observability.expView.seriesBuilder.reportType.aria',
{
defaultMessage: 'This select allows you to choose the type of report you wish to create',
}
);

0 comments on commit d0070c9

Please sign in to comment.