mui / mui/material-ui

[Select] Remove the React.cloneElement usage

Open
#14,943 10 comments 30 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I have a form with two text fields. The first text field works as expected in selecting and closing on click, but the second does and not have have gone in to very hacky territory in order to try to get it to work but it does not.

  • [X ] This is not a v0.x issue.
  • [X ] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

The menu option should blur on click

Current Behavior 😯

It stays open and does not trigger a handleChange or handleBlur event in the parent. In the code sandbox it doesn't even open.

Steps to Reproduce 🕹

Link: https://codesandbox.io/s/create-react-app-forked-s5ouz?file=/src/pages/index.js

Context 🔦

I need wrap the menu in an EnhancedComponent in order to Observe certain fields on the model (async)

Your Environment 🌎

Tech Version
Material-UI v3.6.0
React v16.8.0
Browser chrome 72.0.3626.121
TypeScript no
etc.

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

Start with the linked CodeSandbox reproduction and trace the Material UI Select behavior involving React.cloneElement. Confirm how the two text fields behave, then verify that the menu blurs on click and the parent handleChange and handleBlur events are triggered without the reported regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.