Skip to content

[slider] Fix edge thumb alignment after reveal - #4354

Merged
atomiks merged 11 commits into
mui:masterfrom
atomiks:codex/slider-edge-hidden
Mar 19, 2026
Merged

atomiks merged 11 commits into
mui:masterfrom
atomiks:codex/slider-edge-hidden

Conversation

@atomiks

@atomiks atomiks commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #4303

Summary

This fixes the thumbAlignment="edge" slider case where measuring while hidden could produce NaN% positions that never recovered after the container became visible.

Changes

  • Ignore non-finite inset measurements instead of storing NaN.
  • Recompute inset thumb and indicator positions with ResizeObserver when the thumb or control size changes.
  • Add a regression test covering a slider that mounts inside display: none and later becomes visible.

@atomiks atomiks added component: slider Changes related to the slider component. type: bug It doesn't behave as expected. labels Mar 16, 2026
@pkg-pr-new

pkg-pr-new Bot commented Mar 16, 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@4354
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@4354
    

commit: 77b0937

@mui-bot

mui-bot commented Mar 16, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+228B(+0.05%) 🔺+51B(+0.04%)

Details of bundle changes


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

@netlify

netlify Bot commented Mar 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 77b0937
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69bb5f1ad1f30300098b30b1
😎 Deploy Preview https://deploy-preview-4354--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@atomiks
atomiks force-pushed the codex/slider-edge-hidden branch from bbe1783 to a61e762 Compare March 17, 2026 11:36
@atomiks

atomiks commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex Review

Overview

This patch fixes the slider case where thumbAlignment="edge" is mounted while hidden and can end up with invalid thumb and indicator positions after reveal. It now treats unmeasurable inset positions as unavailable, recomputes when layout becomes measurable, and includes browser regression coverage for both single-thumb and range hidden-to-visible cases.

Findings (None)

No blocking issues found in this patch.

I also did a second pass over render and effect timing, hydration safety, accessibility semantics, API and state design, maintainability, performance, and regression coverage, and I did not find any actionable issues in those areas.

Confidence: 4/5

High confidence based on a full-branch diff review, focused JSDOM and Chromium verification, an explicit category sweep with subagents, and the added range regression test covering the previously missing trailing-indicator branch.

Notes

  • Latest update adds a hidden-to-visible range-slider regression case covering the trailing thumb and indicator-size recomputation path.
  • Verified with pnpm test:jsdom SliderThumb --no-watch, pnpm test:chromium SliderThumb --no-watch, and pnpm prettier.

@atomiks
atomiks marked this pull request as ready for review March 17, 2026 12:09
@atomiks
atomiks merged commit 8e0ab1f into mui:master Mar 19, 2026
7 checks passed
@atomiks
atomiks deleted the codex/slider-edge-hidden branch March 19, 2026 02:31
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] thumbAlignment="edge" produces NaN positions when mounted inside display:none

2 participants