[Select] Label not shrinking with value defined
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
I'm using FormControl with Select to render a standard dropdown which worked fine all the time and also posed no issues in development (with gatsby) like this:
<FormControl fullWidth variant='outlined'>
<InputLabel>Activity</InputLabel>
<Select
label='Activity'
value={store.activity}
onChange={e => store.setActivity(e.target.value as any)}
>
{ACTIVITIES.map(activity => (
<MenuItem key={activity} value={activity}>{activity}</MenuItem>
))}
</Select>
</FormControl>
I'm actually using multiple selects which use the same type of code throughout the page.
However, when I build and publish the page, only the FIRST Select on the page is rendered broken like this when it has a value:

After I focus and blur the input once, it will then continue to look like this:

Thing is, when I reorder the selects on my page, always only the first one encountered on the page has this broken behavior.
I checked for similar issues but could not find any which experienced such an issue and that only when built and published, while still working fine in development.
Expected behavior 🤔
Select should work
Steps to reproduce 🕹
I do not have any concrete way to reproduce this yet
Context 🔦
No response
Your environment 🌎
`npx @mui/envinfo`
System:
OS: Windows 10 10.0.19043
CPU: (6) x64 Intel(R) Core(TM) i5-9600KF CPU @ 3.70GHz
Memory: 19.38 GB / 31.92 GB
Binaries:
Node: 14.16.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - C:\Program Files\nodejs\yarn.CMD
npm: 6.14.12 - C:\Program Files\nodejs\npm.CMD
Managers:
Composer: 1.4 - D:\user\cmd\composer.CMD
pip2: 9.0.1 - C:\Python27\Scripts\pip2.EXE
Utilities:
CMake: 3.11.0 - C:\Program Files\CMake\bin\cmake.EXE
Git: 2.17.1. - C:\Program Files\Git\bin\git.EXE
FFmpeg: 4.3.2 - C:\ProgramData\chocolatey\bin\ffmpeg.EXE
Virtualization:
Docker: 20.10.2 - C:\ProgramData\DockerDesktop\version-bin\docker.EXE
SDKs:
Android SDK:
API Levels: 27
Build Tools: 27.0.3, 28.0.3, 32.0.0
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions: 10.0.16299.0
IDEs:
Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5056338
VSCode: 1.63.2 - C:\Users\Bjoern\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
Visual Studio: 17.0.32112.339 (Visual Studio Community 2022), 16.9.31205.134 (Visual Studio Community 2019)
Languages:
Bash: 4.4.23 - c:\devkitPro\msys2\usr\bin\bash.EXE
Java: 11.0.9 - C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
Perl: 5.28.1 - c:\devkitPro\msys2\usr\bin\perl.EXE
PHP: 7.2.2 - C:\tools\php72\php.EXE
Python: 2.7.14 - C:\Python27\python.EXE
Browsers:
Chrome: 97.0.4692.71
Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.76)
Internet Explorer: 11.0.19041.1202
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided FormControl and Select example in a production build, comparing it with development behavior and checking whether the first Select differs from later ones. Done means a Select with a defined value renders its label shrunk correctly on initial load without requiring focus and blur.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100