[Bug]: Button shims in react-migration-v8-v9 always render the ms-Button--primary class
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript
- Área
- frontend
Línea de trabajo
Lee packages/react/src/components/Button e inspecciona shimButtonProps.tsx y las asignaciones de variantes del shim de botón. Empieza por comprobar cómo variantClassName y primary determinan la clase v8 renderizada, incluido el caso toggle. Actualiza las pruebas pertinentes o añade cobertura para cada shim; después, confirma que los shims default, action, compound, primary y toggle renderizan las clases esperadas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Component
Migration Shims V8
Package version
@fluentui/[email protected] (the current release)
React version
18.3.1
Environment
System:
OS: Windows 11 10.0.26300
CPU: (24) x64 AMD Ryzen 9 7900X 12-Core Processor
Memory: 12.92 GB / 31.16 GB
Browsers:
Chrome: 156.0.8078.47
npmPackages (reproduction page, loaded from esm.sh):
@fluentui/react-migration-v8-v9: 9.10.22
react: 18.3.1
react-dom: 18.3.1
Current Behavior
Every Button shim renders the v8 variant class ms-Button--primary, whichever v8 button it shims. Apps that kept styles or test selectors written against the v8 class names (ms-Button--default, ms-Button--action, ms-Button--compound, and so on) stop matching after moving to the shims.
shimButtonProps.tsx builds the class with:
const variantClassName = props.variantClassName ?? props.primary ? 'ms-Button--primary' : 'ms-Button--default';
That parses as (props.variantClassName ?? props.primary) ? 'ms-Button--primary' : 'ms-Button--default'. Every shim passes a variantClassName (DefaultButtonShim, ActionButtonShim, CompoundButtonShim, MenuButtonShim, ...), so the condition is always truthy and the explicit class is replaced by ms-Button--primary.
Measured with the reproduction below on 9.10.22:
| Shim | v8 class | Shim class |
|---|---|---|
| DefaultButtonShim | ms-Button--default |
ms-Button--primary |
| ActionButtonShim / CommandButtonShim | ms-Button--action ms-Button--command |
ms-Button--primary |
| CompoundButtonShim | ms-Button--compound |
ms-Button--primary |
CompoundButtonShim primary |
ms-Button--compoundPrimary |
ms-Button--primary |
| MenuButtonShim | ms-Button--default |
ms-Button--primary |
DefaultButtonShim toggle |
ms-Button--default |
ms-Button--primary |
Only the primary variants happen to come out right. The v9 appearance is not affected, because it is driven by primary separately; only the v8 class names are wrong.
ToggleButtonShim also sets ms-Button--compound / ms-Button--compoundPrimary, which looks copied from CompoundButtonShim. v8 has no toggle variant class (toggle is a prop on the v8 buttons), so with the precedence fixed alone, a toggled DefaultButtonShim would render ms-Button--compound.
Expected Behavior
Each shim renders the same variant class as the v8 button it replaces, as set in packages/react/src/components/Button:
DefaultButton:ms-Button--default, orms-Button--primarywhenprimaryActionButton/CommandButton:ms-Button--action ms-Button--commandCompoundButton:ms-Button--compound, orms-Button--compoundPrimarywhenprimary- a toggle keeps the class of the button it is (for example
ms-Button--defaultfor a toggledDefaultButton)
Reproduction
https://gist.github.com/jakesalvesen/6b22523f25863eda07652e87536d7355 - a standalone HTML page that loads @fluentui/[email protected] from esm.sh, renders each Button shim, and prints its ms-Button--* classes next to the v8 class.
Steps to reproduce
- Save the gist page and open it in a browser (no build step needed).
- The page renders
DefaultButtonShim,PrimaryButtonShim,ActionButtonShim,CommandButtonShim,CompoundButtonShim,MenuButtonShimand a toggledDefaultButtonShim, then prints a table. - 7 of the 9 rows show
ms-Button--primarywhere v8 renders a different class. - Parenthesizing the fallback,
props.variantClassName ?? (props.primary ? 'ms-Button--primary' : 'ms-Button--default'), makes every non-toggle row match.
Are you reporting an Accessibility issue?
no
Suggested severity
Low - Has or doesn't need a workaround
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.
- Lenguaje dominante
- TypeScript
- Estrellas
- 20.3k
- Forks
- 2.9k
- Merge medio
- 2 d 9 h
- PR fusionados (30 d)
- 67
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/fluentui
-
[Bug]: AreaChart renders SVG rect with negative width and height on initial renderPosiblemente ocupada @huong8373tt-beep la tomó hace 2 días. AbiertoNeeds: Triage :mag: Package: charting Type: Bug :bug:
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
[Bug]: Vertical Slider still logs the deprecated 'slider-vertical' warning in Chromium 132+Posiblemente ocupada @jakesalvesen la tomó hace 5 días. AbiertoFluent UI react-components (v9) Needs: Triage :mag: Type: Bug :bug:
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
microsoft/fluentui#36945 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
@fluentui/web-components: fluent-menu-list loses its arrow keys after it is moved in the DOM (Firefox, Safari)Posiblemente ocupada @asxxb la tomó hace 12 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/fluentui
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
farion1231/cc-switch#8829 ·
Los mantenedores suelen responder en 1 día
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverAbiertodoc-audit enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100