Bug: React throws warning on browser default function
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 251k
- Forks
- 51.4k
- Merge moyen
- 2 j 4 h
- PR mergées (30 j)
- 53
Description
I'm receiving the following "Warning"
Warning: Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>.
in option (created by styled.option)
in styled.option (created by Menu)
in select (created by styled.select)
in styled.select (created by Menu)
in div (created by styled.div)
in styled.div (created by Menu)
React version:
Steps To Reproduce
- create a select with options
return (<select>
<option>a</option>
<option selected>b</option>
</select>);
as usecase: the selected property is defined outside the state of the select component, it is set by navigating the site. As of now it is only a warning, so it works if I use this, but the customer whom I build the application, has strict standards, so as for this warning, it kills the audit of the application, even we stated that it is a React specific warning, not a standard, caused by some coding error.
2. see the warnning whowing up RED in your browser that a simple already built-in function of all browser if overriden and damned eternally.
Code does not have any outside dependencies.
The current behavior
It throws the warning in development.
The expected behavior
It is a standard behavior of all modern browsers, that you can tell the select dropdown or multiselect, that it has one ora other selected by code even from context.
This should not be a warning, as it is a w3c standard feature of the select dropdown. Please remove warnings and what-so-ever that you are forcing developers to do, to avoid using w3c standards.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par la reproduction minimale de / dans l’issue et vérifiez l’avertissement dans une build de développement. Déterminez si l’avertissement peut être supprimé tout en préservant le comportement du navigateur concernant l’option sélectionnée, puis confirmez le résultat avec une reproduction équivalente ; aucun fichier source ni test n’est identifié dans le rapport.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, react
- Domaine
- frontend
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100