Search code examples
reactjsautocompletematerial-uitabindex

Error when use tabIndex in Autocomplete of MUI


I want to use tabIndex in autocomplete of MUI using inputProps={{ tabIndex: tabIndex ?? -1 }} but when I use this property , and then clicked on dropdown button page disappear can any body help me what is the problem ?


Solution

  • You also need to spread the params.inputProps from the Autocomplete:

    <TextField
      {...params}
      inputProps={{ ...params.inputProps, tabIndex: 1 }}
      label="freeSolo"
    />