Skip to content

[slider] Preserve single-element array values on pointer interaction - #5781

Merged
atomiks merged 2 commits into
mui:masterfrom
atomiks:claude/base-ui-issue-5778-357db8
Sep 24, 2026
Merged

atomiks merged 2 commits into
mui:masterfrom
atomiks:claude/base-ui-issue-5778-357db8

Conversation

@atomiks

@atomiks atomiks commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #5778

Root decides the value shape with Array.isArray, but Control and Thumb used values.length > 1. So a single-thumb slider with an array value (defaultValue={[25]} or value={[25]}) got arrays back from keyboard input, but plain numbers from a track press or drag, in both onValueChange and onValueCommitted. On-blur Field validation also got a number.

This PR passes Root's shape as isArrayValue through the context. Control wraps the single-thumb pointer value in an array when it's set, and Thumb uses it for the on-blur validation value. values.length > 1 stays where it really means "more than one thumb": collision handling, input ids and labels.

@atomiks atomiks added component: slider Changes related to the slider component. type: bug It doesn't behave as expected. labels Sep 23, 2026
@atomiks
atomiks marked this pull request as ready for review September 23, 2026 09:56
@pkg-pr-new

pkg-pr-new Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@5781
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5781
    

commit: d7a2ee8

@code-infra-dashboard

code-infra-dashboard Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+71B(+0.02%) 🔺+22B(+0.01%)

Details of bundle changes

Performance

Total duration: 1,129.72 ms -157.80 ms(-12.3%) | Renders: 76 (+0) | Paint: 1,873.20 ms -250.77 ms(-11.8%)

Test Duration Renders
Slider mount (300 instances) 103.63 ms ▼-40.70 ms(-28.2%) 2 (+0)
Checkbox mount (500 instances) 70.16 ms ▼-24.33 ms(-25.7%) 1 (+0)
Popover mount (300 instances) 40.81 ms ▼-16.49 ms(-28.8%) 1 (+0)
Dialog mount (300 instances) 26.84 ms ▼-9.38 ms(-25.9%) 1 (+0)
Combobox open — 500 items 21.96 ms ▼-5.90 ms(-21.2%) 4 (+0)

10 tests within noise — details


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit d7a2ee8
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6ab4dc5eaed87600083bd498
😎 Deploy Preview https://deploy-preview-5781--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks
atomiks merged commit 53e533a into mui:master Sep 24, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: slider Changes related to the slider component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[slider] Single-element array values become numbers on pointer interaction

1 participant