mui / mui/material-ui

[Select] Auto Width title get cropped if longer than input value

Open
#45,276 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Steps to reproduce

Steps:

  1. Open this link to live example: Take the current Auto Width Code Sandbox
  2. Replace the "Age" value of the InputLabel and the Select's label prop with "A Longer Title Than Usual"
  3. Notice the effects of the change on the component
Current behavior

Image
Image

Notice how the input label (title) gets cropped, both when it acts as content and when it is rendered above the actual input's content.

Expected behavior

The entire Select should be wide enough to fit the Title, even if the content is shorter.
The final width of the Select should be max(inputWidth, titleWidth). Right now, it appears to only be based on inputWidth.

Context

This issue is a continuation of rjsf-team/react-jsonschema-form#4484.
Finding a solution here will also fix that one.

Your environment

No response

Search keywords: select title crop too long fit length style styling input value

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.

Research direction

Reproduce the problem in the Select documentation's Auto Width example using the linked CodeSandbox and the longer InputLabel and label text. Trace how the Select determines its width, then verify that the rendered control accommodates the longer title as well as shorter content.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.