Skip to content

[breaking change][textarea] Move padding from wrapper to actual element#48659

Open
silviuaavram wants to merge 2 commits into
mui:masterfrom
silviuaavram:fix/move-textarea-padding-from-wrapper
Open

[breaking change][textarea] Move padding from wrapper to actual element#48659
silviuaavram wants to merge 2 commits into
mui:masterfrom
silviuaavram:fix/move-textarea-padding-from-wrapper

Conversation

@silviuaavram

@silviuaavram silviuaavram commented Jun 11, 2026

Copy link
Copy Markdown
Member

Moves the padding from the wrapper to the <textarea>, in the multiline case. The reason is that, when user was starting a selection from the edge of the textarea, it could also select outside text, which is not correct. Adding the padding to the textarea makes the selection consider that it started from the textarea element, and won't allow selection outside the element.

To test:

  • for any textarea version (outlined, standard, filled), start a selection using pointer from the edge of the textarea, and try to select outside text. it should only select textarea value.
  • no regressions for textareas, regardless of the variant: outlined, standard, filled, small, maxrows, minrows.

BREAKING CHANGE: This change might affect user's customizations, if they rely on the fact that the padding value was on the container, and now it's on the textarea. Consequently, we should merge this in a major, and have a Changelog entry for it.

@silviuaavram silviuaavram added type: bug It doesn't behave as expected. scope: textarea Changes related to the textarea. labels Jun 11, 2026
@silviuaavram silviuaavram requested a review from Janpot June 11, 2026 13:25
@code-infra-dashboard

code-infra-dashboard Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-48659--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material ▼-849B(-0.16%) ▼-129B(-0.08%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts multiline input styling so that padding is applied to the actual <textarea> element (via the input slot) instead of the wrapper/root element. This prevents text selections that start near the edge of a multiline field from “escaping” the textarea and selecting outside page content.

Changes:

  • Remove multiline-specific padding from InputBaseRoot, OutlinedInputRoot, and FilledInputRoot.
  • Remove multiline-specific “reset padding to 0” rules from the corresponding input slots so padding now lives on the rendered <textarea>.
  • Keep autosizing behavior intact by retaining the multiline height: auto / resize: none rules.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/mui-material/src/OutlinedInput/OutlinedInput.js Moves multiline padding responsibility from the root slot to the input slot for outlined multiline textareas.
packages/mui-material/src/InputBase/InputBase.js Removes multiline padding from the root slot and stops zeroing padding on multiline inputs so the textarea carries padding.
packages/mui-material/src/FilledInput/FilledInput.js Moves multiline padding responsibility from the root slot to the input slot for filled multiline textareas (including small/hiddenLabel variants).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@silviuaavram silviuaavram force-pushed the fix/move-textarea-padding-from-wrapper branch from 02f35ff to 881593a Compare June 12, 2026 06:29
@siriwatknp

Copy link
Copy Markdown
Member

It causes one regression https://app.argos-ci.com/mui/material-ui/builds/49452/334888225

I love when the styles are removed! looks much cleaner.

@silviuaavram silviuaavram added the breaking change Introduces changes that are not backward compatible. label Jun 12, 2026
@silviuaavram silviuaavram self-assigned this Jun 12, 2026
@silviuaavram silviuaavram added this to the v10 (Material UI) milestone Jun 12, 2026
@siriwatknp

Copy link
Copy Markdown
Member

👍 This is great, I don't see the argos diff any more (except the scrollbar but it should not block the PR).

@silviuaavram silviuaavram changed the title [textarea] Move padding from wrapper to actual element [breaking change][textarea] Move padding from wrapper to actual element Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible. scope: textarea Changes related to the textarea. type: bug It doesn't behave as expected. v10.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants