Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Provide aria valuetext for range input #1657
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley authored and senadir committed Jul 29, 2020
1 parent fe10302 commit 2ef5ee2
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions assets/js/base/components/price-slider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@ const PriceSlider = ( {
const maxRangeStep =
maxRange && document.activeElement === maxRange.current ? stepValue : 1;

const minRangeValue = Number.isFinite( minPrice )
? minPrice
: minConstraint;
const maxRangeValue = Number.isFinite( maxPrice )
? maxPrice
: maxConstraint;

return (
<div className={ classes }>
<div
Expand All @@ -260,10 +267,9 @@ const PriceSlider = ( {
'Filter products by minimum price',
'woo-gutenberg-products-block'
) }
value={
Number.isFinite( minPrice )
? minPrice
: minConstraint
value={ minRangeValue }
aria-valuetext={
minRangeValue / 10 ** currency.minorUnit + ''
}
onChange={ rangeInputOnChange }
step={ minRangeStep }
Expand All @@ -280,10 +286,9 @@ const PriceSlider = ( {
'Filter products by maximum price',
'woo-gutenberg-products-block'
) }
value={
Number.isFinite( maxPrice )
? maxPrice
: maxConstraint
value={ maxRangeValue }
aria-valuetext={
maxRangeValue / 10 ** currency.minorUnit + ''
}
onChange={ rangeInputOnChange }
step={ maxRangeStep }
Expand Down

0 comments on commit 2ef5ee2

Please sign in to comment.