Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TextField] <Select /> doesn't trigger onChange when its children is react-virtualized's <List /> #16364

Closed
2 tasks done
brianle1301 opened this issue Jun 25, 2019 · 7 comments
Labels
component: select This is the name of the generic UI component, not the React module! component: text field This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature

Comments

@brianle1301
Copy link
Contributor

When react-virtualized's <List /> is used with <TextField select />, onChange is not invoked. I have tried to render the options without virtualising and it worked perfectly.

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

Expected Behavior 🤔

When clicking the option, the onChange function should be invoked, and the value of the field should be updated.

Current Behavior 😯

onChange is not invoked

Steps to Reproduce 🕹

This snippet explains best:


      <TextField
        variant="outlined"
        select
        label="Country"
        margin="normal"
        value={country}
        onChange={handleChange('country')}
        className={classes.inputField}
      >
        <List
          width={300}
          height={400}
          deferredMeasurementCache={cache}
          overscanRowCount={5}
          rowHeight={cache.rowHeight}
          rowCount={COUNTRIES.length}
          rowRenderer={({ index, key, style, parent }) => {
            const { name: countryName, code } = COUNTRIES[index];

            return (
              <CellMeasurer
                key={key}
                rowIndex={index}
                columnIndex={0}
                parent={parent}
                cache={cache}
              >
                <MenuItem value={countryName} style={style} className={classes.menuItem}>
                  {countryName} ({code})
                </MenuItem>
              </CellMeasurer>
            );
          }}
        />
        <MenuItem value="A">A</MenuItem>
      </TextField>

Context 🔦

I'm just trying to render a list of countries and I find out that if I don't virtualise, the list becomes laggy when being opened/closed.

Your Environment 🌎

Tech Version
Material-UI v4.1.2
React v16.8.6
Browser Chrome v75.0.3770.100
TypeScript Nah
@brianle1301 brianle1301 changed the title [TextField] Select wouldn't work with react-virtualized [TextField] <Select /> doesn't trigger onChange when its children is react-virtualized's <List /> Jun 25, 2019
@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 25, 2019

This is not supported, because of #14943.

@oliviertassinari
Copy link
Member

I'm just trying to render a list of countries and I find out that if I don't virtualise, the list becomes laggy when being opened/closed.

Did you try the native implementation?

@brianle1301
Copy link
Contributor Author

brianle1301 commented Jun 25, 2019 via email

@oliviertassinari
Copy link
Member

@dreamsinspace Would the autocomplete better solve the problem https://material-ui.com/components/autocomplete/?

If you want us to implement a richer ComboxBox / AutoComplete MultiSelect, SelectList, upvoting would be a start: #13863. Thanks!

@brianle1301
Copy link
Contributor Author

@oliviertassinari Cheers

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 20, 2022
@zannager zannager added component: select This is the name of the generic UI component, not the React module! component: text field This is the name of the generic UI component, not the React module! labels Dec 27, 2022
@michaldudak
Copy link
Member

@oliviertassinari why have you added the needs triage label?

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 1, 2023

@michaldudak I have added status: needs triage to all the issues that had no labels, about 2,500 of them. We are down to 1,700 right now.

@gzrae Please don't assign people on closed issues, it doesn't really serve a purpose, the goal is only to add the product scope label so developers owning the scope can easily find all the history. A closed 5 years old issue is often as relevant as a closed 1 month old issue.

@oliviertassinari oliviertassinari added enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! component: text field This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

No branches or pull requests

4 participants