@fluentui/web-components: fluent-menu-list loses its arrow keys after it is moved in the DOM (Firefox, Safari)
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript, web-dev
- Área
- accessibility, frontend
Línea de trabajo
El issue identifica el comportamiento en menu-list.js: disconnectedCallback() desconecta el grupo de foco, mientras que setItems() lo reutiliza después de la reconexión. Lee esos métodos y el ciclo de vida del grupo de foco descrito en el issue y, después, reproduce el movimiento del DOM en Firefox o Safari. El trabajo estará terminado cuando ArrowDown mueva el foco por los elementos del menú después del movimiento, igual que lo hace sin el movimiento.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version: @fluentui/web-components 3.1.3, @microsoft/focusgroup-polyfill 1.6.0. Engines: Firefox 153 and WebKit 26.6 (Playwright's builds) fail; Chromium 153 passes, because it has native focusgroup and the polyfill stands aside.
Summary
A fluent-menu-list builds its focus group (the polyfill that gives the arrow keys in an engine without native focusgroup) on its first setItems(), disconnects it when the list leaves the document, and never builds another. Any DOM move, which disconnects and reconnects the element (for example insertBefore, or a framework reordering a list), leaves a menu whose arrow keys do nothing: focus stays on the first item, so Enter chooses the first item whatever the user wanted.
Reproduction
<!doctype html>
<div id="host">
<fluent-menu>
<fluent-button slot="trigger">Actions</fluent-button>
<fluent-menu-list>
<fluent-menu-item>One</fluent-menu-item>
<fluent-menu-item>Two</fluent-menu-item>
<fluent-menu-item>Three</fluent-menu-item>
</fluent-menu-list>
</fluent-menu>
</div>
<script type="module">
import '@fluentui/web-components/button.js';
import '@fluentui/web-components/menu.js';
import '@fluentui/web-components/menu-list.js';
import '@fluentui/web-components/menu-item.js';
// Move the menu in place once, as a framework's reorder would.
const menu = document.querySelector('fluent-menu');
customElements.whenDefined('fluent-menu-list').then(() => menu.parentElement.insertBefore(menu, menu.nextSibling));
</script>
- Open the page in Firefox or Safari. Tab to "Actions" and press Enter: the menu opens with focus on "One".
- Press ArrowDown twice.
- Expected: focus on "Three" (as without the move, and as in Chrome). Actual: focus stays on "One".
The standalone page above reproduces it as written (bundled with esbuild, served to each engine): never moved, "One", "Two", "Three" in all three engines; moved in place once, "One", "Two", "Three" in Chromium and "One", "One", "One" in Firefox and WebKit.
Cause
node_modules/@fluentui/web-components/dist/esm/menu-list/menu-list.js:15-18:disconnectedCallback()callsthis.fg?.disconnect(), and keepsthis.fg.menu-list.js:19-34:setItems()creates theFocusGrouponlyif (!this.fg); otherwise it callsthis.fg.update().node_modules/@microsoft/focusgroup-polyfill/build/focusgroup-shadowless.mjs:101-114: the constructor adds thekeydown,focusinandfocusoutlisteners, once;:127-132:disconnect()aborts them and sets the owner tonull;update()returns at once when there is no owner (:146).
So after a reconnection setItems() "updates" a disconnected group, which does nothing.
Suggested fix
Drop the group when disconnecting (this.fg?.disconnect(); this.fg = undefined;), so the next setItems() builds a new one; or build the group in connectedCallback.
- 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]: Button shims in react-migration-v8-v9 always render the ms-Button--primary classPosiblemente ocupada @jakesalvesen la tomó hace 1 día. AbiertoFluent UI react-components (v9) Needs: Triage :mag: Type: Bug :bug:
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[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 4 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
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