[breaking change][textarea] Move padding from wrapper to actual element#48659
[breaking change][textarea] Move padding from wrapper to actual element#48659silviuaavram wants to merge 2 commits into
Conversation
Deploy previewhttps://deploy-preview-48659--material-ui.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
There was a problem hiding this comment.
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, andFilledInputRoot. - 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: nonerules.
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.
02f35ff to
881593a
Compare
|
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. |
|
👍 This is great, I don't see the argos diff any more (except the scrollbar but it should not block the PR). |
Moves the padding from the wrapper to the
<textarea>, in themultilinecase. 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:
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.