-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
[TablePagination] Fix select variant not working #33974
Changes from all commits
d01c299
26c0c7c
7fa23f4
9b51983
e18a0eb
da058e7
475a225
d41ec9d
7bc5548
9ef1aa8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,7 +114,8 @@ const Select = React.forwardRef(function Select(inProps, ref) { | |
...(multiple && native && variant === 'outlined' ? { notched: true } : {}), | ||
ref: inputComponentRef, | ||
className: clsx(InputComponent.props.className, className), | ||
variant, | ||
// If a custom input is provided via 'input' prop, do not allow 'variant' to be propagated to it's root element. See https://github.com/mui/material-ui/issues/33894. | ||
...(!input && { variant }), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ZeeshanTamboli I think it deserves a comment. Can you add a comment that explain the consition and maybe link to the issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @siriwatknp I added the comment. |
||
...other, | ||
}); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,7 +199,7 @@ const TablePagination = React.forwardRef(function TablePagination(inProps, ref) | |
{rowsPerPageOptions.length > 1 && ( | ||
<TablePaginationSelect | ||
variant="standard" | ||
input={<InputBase />} | ||
{...(!SelectProps.variant && { input: <InputBase /> })} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder why the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's needed. Otherwise, And if variant standard is removed and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed, the |
||
value={rowsPerPage} | ||
onChange={onRowsPerPageChange} | ||
id={selectId} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not propagate
variant
to root div in select input if custom input element is provided via Select'sinput
prop. Basically, do not let variant be set like in the image below:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, it does not introduce a regression if I do this:
So, looks good.