[TextareaAutosize] Adds new row for long placeholder if `nowrap` is applied

Open
#46,543 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, react
Domain
frontend

Research direction

Start with the linked StackBlitz reproduction and inspect TextareaAutosize's height-measurement behavior when a multiline OutlinedInput uses a long placeholder with nowrap. Confirm the height change as the preview width clips the placeholder. Done means the placeholder no longer causes an extra row while normal textarea sizing remains correct.

Written by the indexing model from the issue text.

Description

component: TextareaAutosize scope: text field
Steps to reproduce

Steps:

  1. https://stackblitz.com/edit/dnwvfvkr-xgcxabqs
  2. Drag the preview window slider to adjust its width until it just starts to clip the placeholder
  3. Notice the input height changes just as the end of the placeholder starts to clip outside the text area.
  4. In devtools, we can the see the height is manually set on the text input itself
Current behavior

https://github.com/user-attachments/assets/4db19b14-9136-4ec5-9c42-fb7a6c3637f3

Expected behavior

(this was faked by just setting maxRows to 1)

https://github.com/user-attachments/assets/58a188f2-94dd-4f73-a59e-a7697da834cb

Context

I have a placeholder inside a multiline OutlinedInput that on certain screen sizes and configurations is slightly too large and ends up wrapping onto a new line. I wanted to remove the wrapping from the placeholder, but the measuring done by MUI causes the input to grow in height regardless.

Your environment

No response

Search keywords: input height incorrect, multiline incorrect height

Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mui/material-ui

All issues in mui/material-ui

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.