Skip to content

Commit

Permalink
Cleanup around EuiSuperDatePicker quick select a11y
Browse files Browse the repository at this point in the history
  • Loading branch information
Michail Yasonik committed Oct 14, 2019
1 parent f475ce9 commit 81793de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@
exports[`EuiQuickSelect is rendered 1`] = `
<fieldset>
<EuiI18n
defaults={
Array [
"Quick select a time range",
"Quick select",
]
}
tokens={
Array [
"euiQuickSelect.legendLabel",
"euiQuickSelect.legendText",
]
}
default="Quick select a time range"
token="euiQuickSelect.legendText"
>
<Component />
</EuiI18n>
Expand Down Expand Up @@ -139,18 +129,8 @@ exports[`EuiQuickSelect is rendered 1`] = `
exports[`EuiQuickSelect prevQuickSelect 1`] = `
<fieldset>
<EuiI18n
defaults={
Array [
"Quick select a time range",
"Quick select",
]
}
tokens={
Array [
"euiQuickSelect.legendLabel",
"euiQuickSelect.legendText",
]
}
default="Quick select a time range"
token="euiQuickSelect.legendText"
>
<Component />
</EuiI18n>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,13 @@ export class EuiQuickSelect extends Component {
return (
<fieldset>
<EuiI18n
tokens={['euiQuickSelect.legendLabel', 'euiQuickSelect.legendText']}
defaults={['Quick select a time range', 'Quick select']}>
{([legendLabel, legendText]) => (
token="euiQuickSelect.legendText"
default="Quick select a time range">
{legendText => (
// Legend needs to be the first thing in a fieldset, but we want the visible title within the flex.
// So we hide it, but allow screen readers to see it
<EuiScreenReaderOnly>
<legend
id={legendId}
aria-label={legendLabel}
className="euiFormLabel">
<legend id={legendId} className="euiFormLabel">
{legendText}
</legend>
</EuiScreenReaderOnly>
Expand All @@ -149,7 +146,7 @@ export class EuiQuickSelect extends Component {
token="euiQuickSelect.quickSelectTitle"
default="Quick select">
{quickSelectTitle => (
<div id={legendId} aria-hidden className="euiFormLabel">
<div aria-hidden className="euiFormLabel">
{quickSelectTitle}
</div>
)}
Expand Down

0 comments on commit 81793de

Please sign in to comment.