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

Added aria-hidden to EuiRangeSlider and EuiRangeTrack #3423

Merged
merged 10 commits into from
May 7, 2020
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `aria-hidden = true` to `EuiRangeSlider` and `EuiRangeTrack` if `showInput = true` ([#3423](https://github.com/elastic/eui/pull/3423))
- Added `iconType` prop to `EuiDatePicker` ([#3383](https://github.com/elastic/eui/pull/3383))
- Applied `max-width: 100%` to `EuiPageBody` so inner flex-based items don't overflow their containers ([#3375](https://github.com/elastic/eui/pull/3375))
- Added `titleSize` prop to `EuiStep` and `EuiSteps` ([#3340](https://github.com/elastic/eui/pull/3340))
Expand Down
13 changes: 13 additions & 0 deletions src/components/form/range/__snapshots__/dual_range.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ exports[`EuiDualRange allows value prop to accept empty strings 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<input
Expand Down Expand Up @@ -35,6 +36,7 @@ exports[`EuiDualRange allows value prop to accept numbers 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<div
Expand Down Expand Up @@ -89,6 +91,7 @@ exports[`EuiDualRange input props can be applied to min and max inputs 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="true"
class="euiRangeTrack"
>
<div
Expand Down Expand Up @@ -144,6 +147,7 @@ exports[`EuiDualRange is rendered 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<div
Expand Down Expand Up @@ -182,6 +186,7 @@ exports[`EuiDualRange props compressed should render 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<div
Expand Down Expand Up @@ -217,6 +222,7 @@ exports[`EuiDualRange props custom ticks should render 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="false"
class="euiRangeTrack"
style="margin-right:0.6em"
>
Expand Down Expand Up @@ -277,6 +283,7 @@ exports[`EuiDualRange props disabled should render 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="false"
class="euiRangeTrack euiRangeTrack--disabled"
>
<div
Expand Down Expand Up @@ -313,6 +320,7 @@ exports[`EuiDualRange props fullWidth should render 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<div
Expand Down Expand Up @@ -367,6 +375,7 @@ exports[`EuiDualRange props inputs should render 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="true"
class="euiRangeTrack"
>
<div
Expand Down Expand Up @@ -429,6 +438,7 @@ exports[`EuiDualRange props labels should render 1`] = `
0
</label>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<div
Expand Down Expand Up @@ -469,6 +479,7 @@ exports[`EuiDualRange props levels should render 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<div
Expand Down Expand Up @@ -516,6 +527,7 @@ exports[`EuiDualRange props range should render 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<div
Expand Down Expand Up @@ -601,6 +613,7 @@ exports[`EuiDualRange props ticks should render 1`] = `
class="euiRange__horizontalSpacer"
/>
<div
aria-hidden="false"
class="euiRangeTrack"
style="margin-right:0.6em"
>
Expand Down
26 changes: 26 additions & 0 deletions src/components/form/range/__snapshots__/range.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ exports[`EuiRange allows value prop to accept a number 1`] = `
class="euiRangeWrapper euiRange"
>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<input
aria-hidden="false"
class="euiRangeSlider"
id="generated-id"
max="100"
Expand Down Expand Up @@ -38,9 +40,11 @@ exports[`EuiRange allows value prop to accept empty string 1`] = `
class="euiRangeWrapper euiRange"
>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<input
aria-hidden="false"
class="euiRangeSlider"
id="generated-id"
max="100"
Expand All @@ -61,9 +65,11 @@ exports[`EuiRange is rendered 1`] = `
class="euiRangeWrapper euiRange testClass1 testClass2"
>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<input
aria-hidden="false"
aria-label="aria-label"
class="euiRangeSlider"
data-test-subj="test subject string"
Expand All @@ -87,9 +93,11 @@ exports[`EuiRange props compressed should render 1`] = `
class="euiRangeWrapper euiRangeWrapper--compressed euiRange"
>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<input
aria-hidden="false"
class="euiRangeSlider euiRangeSlider--compressed"
id="generated-id"
max="100"
Expand All @@ -110,6 +118,7 @@ exports[`EuiRange props custom ticks should render 1`] = `
class="euiRangeWrapper euiRange"
>
<div
aria-hidden="false"
class="euiRangeTrack"
style="margin-right:0.6em"
>
Expand Down Expand Up @@ -138,6 +147,7 @@ exports[`EuiRange props custom ticks should render 1`] = `
</button>
</div>
<input
aria-hidden="false"
class="euiRangeSlider euiRangeSlider--hasTicks"
id="generated-id"
max="100"
Expand All @@ -158,9 +168,11 @@ exports[`EuiRange props disabled should render 1`] = `
class="euiRangeWrapper euiRange"
>
<div
aria-hidden="false"
class="euiRangeTrack euiRangeTrack--disabled"
>
<input
aria-hidden="false"
class="euiRangeSlider"
disabled=""
id="generated-id"
Expand All @@ -182,9 +194,11 @@ exports[`EuiRange props fullWidth should render 1`] = `
class="euiRangeWrapper euiRangeWrapper--fullWidth euiRange"
>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<input
aria-hidden="false"
class="euiRangeSlider"
id="generated-id"
max="100"
Expand All @@ -205,9 +219,11 @@ exports[`EuiRange props input should render 1`] = `
class="euiRangeWrapper euiRange testClass1 testClass2"
>
<div
aria-hidden="true"
class="euiRangeTrack"
>
<input
aria-hidden="true"
aria-label="aria-label"
class="euiRangeSlider"
data-test-subj="test subject string"
Expand Down Expand Up @@ -257,9 +273,11 @@ exports[`EuiRange props labels should render 1`] = `
0
</label>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<input
aria-hidden="false"
class="euiRangeSlider"
id="generated-id"
max="100"
Expand All @@ -285,6 +303,7 @@ exports[`EuiRange props levels should render 1`] = `
class="euiRangeWrapper euiRange"
>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<div
Expand All @@ -300,6 +319,7 @@ exports[`EuiRange props levels should render 1`] = `
/>
</div>
<input
aria-hidden="false"
class="euiRangeSlider"
id="generated-id"
max="100"
Expand All @@ -320,6 +340,7 @@ exports[`EuiRange props range should render 1`] = `
class="euiRangeWrapper euiRange"
>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<div
Expand All @@ -331,6 +352,7 @@ exports[`EuiRange props range should render 1`] = `
/>
</div>
<input
aria-hidden="false"
class="euiRangeSlider euiRangeSlider--hasRange"
id="generated-id"
max="100"
Expand Down Expand Up @@ -384,6 +406,7 @@ exports[`EuiRange props ticks should render 1`] = `
class="euiRangeWrapper euiRange"
>
<div
aria-hidden="false"
class="euiRangeTrack"
style="margin-right:0.6em"
>
Expand Down Expand Up @@ -447,6 +470,7 @@ exports[`EuiRange props ticks should render 1`] = `
</button>
</div>
<input
aria-hidden="false"
class="euiRangeSlider euiRangeSlider--hasTicks"
id="generated-id"
max="100"
Expand All @@ -467,9 +491,11 @@ exports[`EuiRange props value should render 1`] = `
class="euiRangeWrapper euiRange"
>
<div
aria-hidden="false"
class="euiRangeTrack"
>
<input
aria-hidden="false"
class="euiRangeSlider"
id="generated-id"
max="100"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

exports[`EuiRangeTrack is rendered 1`] = `
<div
class="euiRangeTrack"
aria-label="aria-label"
class="testClass1 testClass2"
data-test-subj="test subject string"
style="margin-right:0.6em"
>
<div
Expand Down
3 changes: 2 additions & 1 deletion src/components/form/range/dual_range.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ export class EuiDualRange extends Component<EuiDualRangeProps> {
ticks={ticks}
levels={levels}
onChange={this.handleSliderChange}
value={value}>
value={value}
aria-hidden={showInput === true ? true : false}>
ashikmeerankutty marked this conversation as resolved.
Show resolved Hide resolved
{showRange && this.isValid && (
<EuiRangeHighlight
compressed={compressed}
Expand Down
4 changes: 3 additions & 1 deletion src/components/form/range/range.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ export class EuiRange extends Component<EuiRangeProps> {
ticks={ticks}
levels={levels}
onChange={this.handleOnChange}
value={value}>
value={value}
aria-hidden={showInput === true ? true : false}>
{showRange && this.isValid && (
<EuiRangeHighlight
compressed={compressed}
Expand Down Expand Up @@ -287,6 +288,7 @@ export class EuiRange extends Component<EuiRangeProps> {
}
onFocus={showInput === true ? undefined : onFocus}
onBlur={showInputOnly ? this.onInputBlur : onBlur}
aria-hidden={showInput === true ? true : false}
ashikmeerankutty marked this conversation as resolved.
Show resolved Hide resolved
{...rest}
/>

Expand Down
3 changes: 2 additions & 1 deletion src/components/form/range/range_track.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export class EuiRangeTrack extends Component<EuiRangeTrackProps> {
onChange,
value,
compressed,
...rest
} = this.props;

// TODO: Move these to only re-calculate if no-value props have changed
Expand Down Expand Up @@ -167,7 +168,7 @@ export class EuiRangeTrack extends Component<EuiRangeTrackProps> {
});

return (
<div className={trackClasses} style={inputWrapperStyle}>
<div className={trackClasses} style={inputWrapperStyle} {...rest}>
ashikmeerankutty marked this conversation as resolved.
Show resolved Hide resolved
{levels && !!levels.length && (
<EuiRangeLevels
compressed={compressed}
Expand Down