Skip to content

[number field][slider] Fix missing field state data attributes - #3909

Merged
mj12albert merged 3 commits into
mui:masterfrom
mj12albert:fix/missing-field-state-data-attrs
Feb 2, 2026
Merged

mj12albert merged 3 commits into
mui:masterfrom
mj12albert:fix/missing-field-state-data-attrs

Conversation

@mj12albert

Copy link
Copy Markdown
Member

Fixes #3908

@mj12albert mj12albert added component: slider Changes related to the slider component. component: number field Changes related to the number field component. labels Feb 1, 2026
@pkg-pr-new

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

commit: 1738a83

@mui-bot

mui-bot commented Feb 1, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+12B(0.00%) 🔺+5B(0.00%)

Details of bundle changes


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

@netlify

netlify Bot commented Feb 1, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 1738a83
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6980a7a345c0f100078b90e0
😎 Deploy Preview https://deploy-preview-3909--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.

@mj12albert
mj12albert force-pushed the fix/missing-field-state-data-attrs branch from 7e754c7 to 512d843 Compare February 2, 2026 06:59
@mj12albert mj12albert changed the title Fix missing field state data attrs [number field][slider] Fix missing field state data attributes Feb 2, 2026
@mj12albert mj12albert added the type: bug It doesn't behave as expected. label Feb 2, 2026
@mj12albert
mj12albert marked this pull request as ready for review February 2, 2026 07:06
@greptile-apps

greptile-apps Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Fixed missing field state data attributes (data-valid and data-invalid) on NumberField and Slider root components by adding fieldValidityMapping to their state attribute mappings. This ensures consistency with other field components like Switch, Radio, and Combobox that already include these attributes.

  • Added fieldValidityMapping spread to packages/react/src/number-field/utils/stateAttributesMapping.ts
  • Added fieldValidityMapping spread to packages/react/src/slider/root/stateAttributesMapping.ts
  • Added comprehensive test coverage verifying the attributes appear correctly on root and child elements during validation state changes

Confidence Score: 5/5

  • Safe to merge - straightforward bug fix with comprehensive test coverage
  • The changes are minimal, follow established patterns used in other components (Switch, Radio, Combobox), and include thorough test coverage that validates the fix works correctly
  • No files require special attention

Important Files Changed

Filename Overview
packages/react/src/number-field/utils/stateAttributesMapping.ts Added fieldValidityMapping to expose valid/invalid state attributes on NumberField root
packages/react/src/slider/root/stateAttributesMapping.ts Added fieldValidityMapping to expose valid/invalid state attributes on Slider root
packages/react/src/number-field/root/NumberFieldRoot.test.tsx Added tests verifying data-valid and data-invalid attributes on root and input elements
packages/react/src/slider/root/SliderRoot.test.tsx Added tests verifying data-valid and data-invalid attributes on root and thumb elements

@mj12albert
mj12albert merged commit 7195d2e into mui:master Feb 2, 2026
7 checks passed
@mj12albert
mj12albert deleted the fix/missing-field-state-data-attrs branch February 2, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: number field Changes related to the number field component. 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.

[number field] Not adding data-invalid attribute

3 participants