Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pickers] Console error about non-boolean attribute 'focused' when using DatePicker / DateTimePicker for custom columns in DataGrid #12018

Closed
wlee-vendelux opened this issue Feb 10, 2024 · 6 comments · Fixed by #12092
Labels
component: pickers This is the name of the generic UI component, not the React module! support: commercial Support request from paid users support: question Community support but can be turned into an improvement

Comments

@wlee-vendelux
Copy link

wlee-vendelux commented Feb 10, 2024

The problem in depth

Warning: Received `true` for a non-boolean attribute `focused`.
If you want to write it to the DOM, pass a string instead: focused="true" or focused={value.toString()}.

Your environment

No response

Search keywords: datepicker datetimepicker datagrid non-boolean focused
Order ID: 69589

@wlee-vendelux wlee-vendelux added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Feb 10, 2024
@michelengelen
Copy link
Member

Thanks for raising this @wlee-vendelux
I am not sure where exactly this attribute comes from @LukasTy ... From a quick investigation I guess it is this line that add the focused attribute to the DOM:


Could it be that it gets passed down all the way to the InputBase component through props-spreading? 🤔

@michelengelen michelengelen added bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! component: DateTimePicker The React component. component: DatePicker The React component. and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 12, 2024
@michelengelen michelengelen changed the title [question] Console error about non-boolean attribute 'focused' when using DatePicker / DateTimePicker for custom columns in DataGrid [pickers] Console error about non-boolean attribute 'focused' when using DatePicker / DateTimePicker for custom columns in DataGrid Feb 12, 2024
@flaviendelangle
Copy link
Member

@michelengelen the component you linked does not exist in v6 and is not used by default in v7, it can't be the source of the problem

@michelengelen
Copy link
Member

@michelengelen the component you linked does not exist in v6 and is not used by default in v7, it can't be the source of the problem

It is not? I am sorry! I will investigate this tomorrow a bit deeper!

@flaviendelangle
Copy link
Member

In v6 we are using @mui/material/TextField 👍

@michelengelen
Copy link
Member

Ok, I found the issue. The problem was that the WrappedGridEditDateInput got passed the focused prop, but it does not exist on InputBase which is being used in the demo.

You can change this by just removing focused from the props.

function WrappedGridEditDateInput(props: TextFieldProps) {
  const { InputProps, focused, ...other } = props;
  return <GridEditDateInput fullWidth {...InputProps} {...(other as InputBaseProps)} />;
}

@flaviendelangle Thanks for pointing that out. I searched in the wrong place! 🙇🏼

@LukasTy LukasTy added support: question Community support but can be turned into an improvement status: waiting for author Issue with insufficient information and removed bug 🐛 Something doesn't work component: DateTimePicker The React component. component: DatePicker The React component. labels Feb 16, 2024
@LukasTy LukasTy removed the status: waiting for author Issue with insufficient information label Feb 16, 2024
Copy link

⚠️ This issue has been closed.
If you have a similar problem, please open a new issue and provide details about your specific problem.
If you can provide additional information related to this topic that could help future readers, please feel free to leave a comment.

How did we do @wlee-vendelux?
Your experience with our support team matters to us. If you have a moment, please share your thoughts through our brief survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! support: commercial Support request from paid users support: question Community support but can be turned into an improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants