Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

263
Visualizações
Why does one of my Material UI autocomplete elements have a blue background for the options, but the other doesn't? (includes code sandbox)

FINAL EDIT: I ended up finding a fix and I updated my sandbox with it!

EDIT: I have determined that it is due to this line in the autocomplete...

isOptionEqualToValue={(option, value) => option.id === value.id}

However, if I try to change it to this...

isOptionEqualToValue={(option, value) => option.label === value.label}

I get the following error in the console...

useAutocomplete.js:219 MUI: The value provided to Autocomplete is invalid. None of the options match with "Lisinopril". You can use the isOptionEqualToValue prop to customize the equality test.


I have created the following form using Material UI and React Hook Form...

https://codesandbox.io/s/inputquestion-jyq5b?file=/src/App.js

I am very stumped on why the two autocomplete elements are styled differently with a light blue background for the options/the options' hovers, but the other one isn't.

Thanks in advance for any help you can provide!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Probably because the one with the disabledPortal prop is rendered inside the container (Box) with the applied style. The other one has the default disablePortal value set to false so it is rendered using react portal thus outside the Box. Try setting this prop the same and see if they are the same.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda