-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
scope: pickersChanges related to the date/time pickers.Changes related to the date/time pickers.type: bugIt doesn't behave as expected.It doesn't behave as expected.
Description
Steps to reproduce
Steps:
- Add any
htmlInput
override forMuiTextField
slotProps
withincreateTheme()
:
let theme = createTheme({
components: {
MuiTextField: {
defaultProps: {
slotProps: {
htmlInput: {
sx: {
margin: "10px 0",
},
}
},
},
},
},
});
- Add a
DatePicker
component to the application. - Click on the input text field of the date picker.
Current behavior
The following runtime error is presented when replicating on desktop (haven't tried mobile):
Uncaught TypeError: Cannot read properties of null (reading 'selectionStart')
at syncSelectionFromDOM (useFieldV6TextField.js:142:1)
at useFieldV6TextField.js:185:1
at useEventCallback.js:18:1
at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
at Sl.dtAWF [as aWF] (745a23c5b80d9e64_complete.js:265:226)
at Qb.dispatchWrapper (745a23c5b80d9e64_complete.js:424:156)
at z.dispatchEvent (745a23c5b80d9e64_complete.js:410:187)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
at invokeGuardedCallback (react-dom.development.js:4277:1)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:1)
Expected behavior
Able to click on the date picker input without the application crashing.
Context
Should be able to override the htmlInput
slot prop for TextField
at the theme level without negatively affecting DatePicker
input.
Luckily, I was able to replace my htmlInput
slotProp with the input
slotProp
to get things working.
Your environment
npx @mui/envinfo
Browsers:
Microsoft Edge
Version 129.0.2792.52 (Official build) (arm64)
Google Chrome
Version 128.0.6613.139 (Official Build) (arm64)
System:
OS: Linux 5.15 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
Binaries:
Node: 22.9.0 - /usr/local/bin/node
npm: 10.8.3 - /usr/local/bin/npm
pnpm: Not Found
Browsers:
Chrome: Not Found
npmPackages:
@emotion/react: ^11.13.0 => 11.13.3
@emotion/styled: ^11.13.0 => 11.13.0
@mui/core-downloads-tracker: 6.1.0
@mui/icons-material: ^6.1.0 => 6.1.0
@mui/material: ^6.1.0 => 6.1.0
@mui/private-theming: 6.1.0
@mui/styled-engine: 6.1.0
@mui/system: 6.1.0
@mui/types: 7.2.16
@mui/utils: 6.1.0
@mui/x-date-pickers: ^7.17.0 => 7.17.0
@mui/x-internals: 7.17.0
@types/react: 18.3.7
react: ^18.3.1 => 18.3.1
react-dom: ^18.3.1 => 18.3.1
Search keywords: DatePicker selectionStart
michael-preuss and Iran-110GuysmoB
Metadata
Metadata
Assignees
Labels
scope: pickersChanges related to the date/time pickers.Changes related to the date/time pickers.type: bugIt doesn't behave as expected.It doesn't behave as expected.