Provide a general summary of the issue here
When <ProgressBar> or <Meter> is rendered with minValue === maxValue (e.g. value={0}, maxValue={0} with the default minValue={0}), the internally computed percentage is NaN. This propagates into the render-prop percentage value and into aria-valuetext.
🤔 Expected Behavior?
When the range is empty (minValue === maxValue), percentage should resolve to 0 rather than NaN.
😯 Current Behavior
In both packages/react-aria-components/src/ProgressBar.tsx and packages/react-aria-components/src/Meter.tsx, the computation is:
let percentage = ((value - minValue) / (maxValue - minValue)) * 100;
With value = 0, minValue = 0, maxValue = 0, this evaluates to 0 / 0 = NaN. There is no guard. Consequences:
- The render-prop
{({ percentage }) => …} receives NaN. Consumer code such as style={{ width: `${percentage}%` }} produces the string "NaN%", which browsers reject — the fill collapses.
aria-valuetext is formatted from NaN via Intl.NumberFormat, so screen readers announce "NaN%".
💁 Possible Solution
No response
🔦 Context
No response
🖥️ Steps to Reproduce
https://stackblitz.com/edit/hg7dmnxk?file=src%2FExample.tsx
Version
react-aria-components@1.17.0
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
macOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
Provide a general summary of the issue here
When
<ProgressBar>or<Meter>is rendered withminValue === maxValue(e.g.value={0},maxValue={0}with the defaultminValue={0}), the internally computedpercentageisNaN. This propagates into the render-proppercentagevalue and intoaria-valuetext.🤔 Expected Behavior?
When the range is empty (
minValue === maxValue),percentageshould resolve to0rather thanNaN.😯 Current Behavior
In both
packages/react-aria-components/src/ProgressBar.tsxandpackages/react-aria-components/src/Meter.tsx, the computation is:With
value = 0,minValue = 0,maxValue = 0, this evaluates to0 / 0 = NaN. There is no guard. Consequences:{({ percentage }) => …}receivesNaN. Consumer code such asstyle={{ width: `${percentage}%` }}produces the string"NaN%", which browsers reject — the fill collapses.aria-valuetextis formatted fromNaNviaIntl.NumberFormat, so screen readers announce"NaN%".💁 Possible Solution
No response
🔦 Context
No response
🖥️ Steps to Reproduce
https://stackblitz.com/edit/hg7dmnxk?file=src%2FExample.tsx
Version
react-aria-components@1.17.0
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
macOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response