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

Mui input base text area style is not applied correctly with input props on 5.15.11 from 5.15.10 #42774

Closed
TangMichael opened this issue Jun 27, 2024 · 6 comments
Assignees
Labels
component: text field This is the name of the generic UI component, not the React module! component: TextareaAutosize The React component.

Comments

@TangMichael
Copy link

TangMichael commented Jun 27, 2024

Steps to reproduce

Link to live example: (required)
https://stackblitz.com/edit/react-qhoqwr?file=Demo.tsx

Steps:

  1. Use material-ui 5.15.11 or higher
  2. Add multiline props to make a text area to the input base
  3. add inputProps with style and height of 100

Current behavior

Height of the component is bigger than 100

Expected behavior

Height should be at 100

Context

Re-making the issue as it was closed previously and I did not get an answer regarding this change of behaviour.

It looks like the first textarea does not contain the style applied to it. I would think it would work fine with the fix done here: #41369

If you were to use the dependency of @mui/material to 5.15.10, using the same props, the textarea will correctly be at 100px. Here is another stackblitz with the dependency updated.

https://stackblitz.com/edit/react-qhoqwr-pewfah?file=package.json

I did not see anything in the release note between 5.15.10 and 5.15.11 that would do this change. Is it possible I am missing something when doing this change?

This is how it looks like with mui 5.15.10
5 15 10

With the exact same code but changing the mui version to 5.15.11+, this is how it looks like:
5 15 11

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: input base, text area

@TangMichael TangMichael added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 27, 2024
@zannager zannager added component: text field This is the name of the generic UI component, not the React module! component: TextareaAutosize The React component. labels Jun 27, 2024
@DiegoAndai
Copy link
Member

@ZeeshanTamboli this broke in #40789 and, for some reason #41369 didn't fix it. May I ask you to take a look? Weirdly, the height seems to be multiplied x4 🤔

@ZeeshanTamboli
Copy link
Member

I think I know why this broke. But before explaining, @TangMichael, why are you applying the height style when the rows prop already determines the textarea height using the rows value?

@ZeeshanTamboli ZeeshanTamboli added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jun 30, 2024
@TangMichael
Copy link
Author

TangMichael commented Jul 5, 2024

@ZeeshanTamboli We used the height style to have a more precise size to match the designs to the pixels. Can the rows value be used to do the same?

After seeing your comments with the rows, I can see that the height of the style is multiplied by the rows number which is why on v5.15.11+, the height is 400 when I have rows set to 4 and the style of the height set to 100.

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Jul 5, 2024
@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Jul 6, 2024

If you want the height to match the design exactly, why are you using the rows prop?

@ZeeshanTamboli ZeeshanTamboli added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jul 6, 2024
@TangMichael
Copy link
Author

The codebase already contained those two props and it worked fine so it was kept like this. We only noticed this issue when upgrading the library version.

I can remove one of the other if that fixes the issue. Would you say this is intended behaviour starting from 5.15.11+?

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Jul 8, 2024
@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Jul 8, 2024

Would you say this is intended behaviour starting from 5.15.11+?

This is the correct behavior. It was incorrect before 5.15.11, and the new logic in #40789 exposed this improper prop usage. Either provide a static height using the height style or let the textarea determine its height using the rows attribute. The combination of both doesn't make sense. I think we can close this issue.

@ZeeshanTamboli ZeeshanTamboli removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! component: TextareaAutosize The React component.
Projects
None yet
Development

No branches or pull requests

4 participants