Skip to content

Commit

Permalink
Variety of quick a11y fixes (#46569)
Browse files Browse the repository at this point in the history
Focusing on heading structure and page layout for Home, Discover, Dashboard, and Visualize.

This is progress on #37539
  • Loading branch information
Michail Yasonik authored Oct 3, 2019
1 parent 127eab0 commit ea18949
Show file tree
Hide file tree
Showing 33 changed files with 186 additions and 145 deletions.
14 changes: 8 additions & 6 deletions src/core/public/chrome/ui/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import Url from 'url';

import React, { Component, createRef, Fragment } from 'react';
import React, { Component, createRef } from 'react';
import * as Rx from 'rxjs';

import {
Expand Down Expand Up @@ -376,7 +376,7 @@ class HeaderUI extends Component<Props, State> {
];

return (
<Fragment>
<header>
<EuiHeader>
<EuiHeaderSection grow={false}>
<EuiShowFor sizes={['xs', 's']}>
Expand Down Expand Up @@ -407,11 +407,13 @@ class HeaderUI extends Component<Props, State> {
isLocked={isLocked}
onIsLockedUpdate={onIsLockedUpdate}
>
<EuiNavDrawerGroup listItems={recentLinksArray} />
<EuiHorizontalRule margin="none" />
<EuiNavDrawerGroup data-test-subj="navDrawerAppsMenu" listItems={navLinksArray} />
<nav>
<EuiNavDrawerGroup listItems={recentLinksArray} />
<EuiHorizontalRule margin="none" />
<EuiNavDrawerGroup data-test-subj="navDrawerAppsMenu" listItems={navLinksArray} />
</nav>
</EuiNavDrawer>
</Fragment>
</header>
);
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import { Component } from 'react';
import React from 'react';
import { i18n } from '@kbn/i18n';

import { EuiFieldText, EuiOutsideClickDetector, PopoverAnchorPosition } from '@elastic/eui';

Expand Down Expand Up @@ -438,23 +439,30 @@ export class QueryBarInputUI extends Component<Props, State> {
}

public render() {
const isSuggestionsVisible = this.state.isSuggestionsVisible && {
'aria-controls': 'kbnTypeahead__items',
'aria-owns': 'kbnTypeahead__items',
};
const ariaCombobox = { ...isSuggestionsVisible, role: 'combobox' };

return (
<EuiOutsideClickDetector onOutsideClick={this.onOutsideClick}>
<div
{...ariaCombobox}
style={{ position: 'relative' }}
role="combobox"
aria-label={i18n.translate('data.query.queryBar.comboboxAriaLabel', {
defaultMessage: 'Search and filter the {pageType} page',
values: { pageType: this.services.appName },
})}
aria-haspopup="true"
aria-expanded={this.state.isSuggestionsVisible}
aria-owns="kbnTypeahead__items"
aria-controls="kbnTypeahead__items"
>
<div role="search">
<div className="kuiLocalSearchAssistedInput">
<EuiFieldText
placeholder={
this.props.placeholder ||
this.props.intl.formatMessage({
id: 'data.query.queryBar.searchInputPlaceholder',
i18n.translate('data.query.queryBar.searchInputPlaceholder', {
defaultMessage: 'Search',
})
}
Expand All @@ -472,26 +480,17 @@ export class QueryBarInputUI extends Component<Props, State> {
}}
autoComplete="off"
spellCheck={false}
aria-label={
this.props.screenTitle
? this.props.intl.formatMessage(
{
id: 'data.query.queryBar.searchInputAriaLabel',
defaultMessage:
'You are on search box of {previouslyTranslatedPageTitle} page. Start typing to search and filter the {pageType}',
},
{
previouslyTranslatedPageTitle: this.props.screenTitle,
pageType: this.services.appName,
}
)
: undefined
}
aria-label={i18n.translate('data.query.queryBar.searchInputAriaLabel', {
defaultMessage: 'Start typing to search and filter the {pageType} page',
values: { pageType: this.services.appName },
})}
type="text"
aria-autocomplete="list"
aria-controls="kbnTypeahead__items"
aria-controls={this.state.isSuggestionsVisible ? 'kbnTypeahead__items' : undefined}
aria-activedescendant={
this.state.isSuggestionsVisible ? 'suggestion-' + this.state.index : ''
this.state.isSuggestionsVisible && typeof this.state.index === 'number'
? `suggestion-${this.state.index}`
: undefined
}
role="textbox"
prepend={this.props.prepend}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ function LabelsPanel({ stateParams, setValue, setGaugeValue }: GaugeOptionsInter
return (
<EuiPanel paddingSize="s">
<EuiTitle size="xs">
<h2>
<h3>
<FormattedMessage
id="kbnVislibVisTypes.controls.gaugeOptions.labelsTitle"
defaultMessage="Labels"
/>
</h2>
</h3>
</EuiTitle>
<EuiSpacer size="s" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ function RangesPanel({
return (
<EuiPanel paddingSize="s">
<EuiTitle size="xs">
<h2>
<h3>
<FormattedMessage
id="kbnVislibVisTypes.controls.gaugeOptions.rangesTitle"
defaultMessage="Ranges"
/>
</h2>
</h3>
</EuiTitle>
<EuiSpacer size="s" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ function StylePanel({ aggs, setGaugeValue, stateParams, vis }: GaugeOptionsInter
return (
<EuiPanel paddingSize="s">
<EuiTitle size="xs">
<h2>
<h3>
<FormattedMessage
id="kbnVislibVisTypes.controls.gaugeOptions.styleTitle"
defaultMessage="Style"
/>
</h2>
</h3>
</EuiTitle>
<EuiSpacer size="s" />

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ function CategoryAxisPanel(props: CategoryAxisPanelProps) {
return (
<EuiPanel paddingSize="s">
<EuiTitle size="xs">
<h2>
<h3>
<FormattedMessage
id="kbnVislibVisTypes.controls.pointSeries.categoryAxis.xAxisTitle"
defaultMessage="X-axis"
/>
</h2>
</h3>
</EuiTitle>
<EuiSpacer size="s" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ function SeriesPanel(props: SeriesPanelProps) {
return (
<EuiPanel paddingSize="s">
<EuiTitle size="xs">
<h2>
<h3>
<FormattedMessage
id="kbnVislibVisTypes.controls.pointSeries.series.metricsTitle"
defaultMessage="Metrics"
/>
</h2>
</h3>
</EuiTitle>
<EuiSpacer size="s" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ function ValueAxesPanel(props: ValueAxesPanelProps) {
<EuiFlexGroup gutterSize="none" justifyContent="spaceBetween" alignItems="baseline">
<EuiFlexItem grow={false}>
<EuiTitle size="xs">
<h2>
<h3>
<FormattedMessage
id="kbnVislibVisTypes.controls.pointSeries.valueAxes.yAxisTitle"
defaultMessage="Y-axes"
/>
</h2>
</h3>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ function PieOptions(props: VisOptionsProps<PieVisParams>) {
<>
<EuiPanel paddingSize="s">
<EuiTitle size="xs">
<h2>
<h3>
<FormattedMessage
id="kbnVislibVisTypes.editors.pie.pieSettingsTitle"
defaultMessage="Pie settings"
/>
</h2>
</h3>
</EuiTitle>
<EuiSpacer size="s" />
<SwitchOption
Expand All @@ -59,12 +59,12 @@ function PieOptions(props: VisOptionsProps<PieVisParams>) {

<EuiPanel paddingSize="s">
<EuiTitle size="xs">
<div>
<h3>
<FormattedMessage
id="kbnVislibVisTypes.editors.pie.labelsSettingsTitle"
defaultMessage="Labels settings"
/>
</div>
</h3>
</EuiTitle>
<EuiSpacer size="s" />
<SwitchOption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ function GridPanel({ stateParams, setValue, hasHistogramAgg }: VisOptionsProps<B
return (
<EuiPanel paddingSize="s">
<EuiTitle size="xs">
<h2>
<h3>
<FormattedMessage
id="kbnVislibVisTypes.controls.pointSeries.gridAxis.gridText"
defaultMessage="Grid"
/>
</h2>
</h3>
</EuiTitle>

<EuiSpacer size="m" />
Expand Down
Loading

0 comments on commit ea18949

Please sign in to comment.