Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

@fluentui/web-components: fluent-menu-list loses its arrow keys after it is moved in the DOM (Firefox, Safari)

Aperta Adatta ai principianti
#36,869 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@asxxb ci sta già lavorando.

Dal 12/10/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript, web-dev

Direzione di ricerca

La issue descrive il comportamento in menu-list.js: disconnectedCallback() disconnette il gruppo di focus, mentre setItems() lo riutilizza dopo la riconnessione. Leggi questi metodi e il ciclo di vita del gruppo di focus descritto nella issue, poi riproduci lo spostamento del DOM in Firefox o Safari. Il lavoro è completato quando ArrowDown sposta il focus tra gli elementi del menu dopo lo spostamento, come fa senza lo spostamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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>
  1. Open the page in Firefox or Safari. Tab to "Actions" and press Enter: the menu opens with focus on "One".
  2. Press ArrowDown twice.
  3. 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() calls this.fg?.disconnect(), and keeps this.fg.
  • menu-list.js:19-34: setItems() creates the FocusGroup only if (!this.fg); otherwise it calls this.fg.update().
  • node_modules/@microsoft/focusgroup-polyfill/build/focusgroup-shadowless.mjs:101-114: the constructor adds the keydown, focusin and focusout listeners, once; :127-132: disconnect() aborts them and sets the owner to null; 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.

Lingua principale
TypeScript
Stelle
20.3k
Fork
2.9k
Merge medio
2g 10h
PR unite (30g)
72

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/fluentui

Tutte le issue di microsoft/fluentui

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.