@fluentui/web-components: fluent-menu-list loses its arrow keys after it is moved in the DOM (Firefox, Safari)
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript, web-dev
調査の方向性
issue では menu-list.js の動作が示されています。disconnectedCallback() はフォーカスグループを切断し、setItems() は再接続後にそれを再利用します。これらのメソッドと、issue に記載されたフォーカスグループのライフサイクルを読み、その後 Firefox または Safari で DOM の移動を再現してください。移動後も、移動しなかった場合と同じように ArrowDown でメニュー項目間をフォーカスが移動すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 20.3k
- フォーク
- 2.9k
- 平均マージ
- 2日 9時間
- マージ済み PR(30日)
- 70
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/fluentui のほかの issue
-
[Bug]: AreaChart renders SVG rect with negative width and height on initial render対応中かも @huong8373tt-beep が今日担当しました。 オープンNeeds: Triage :mag: Package: charting Type: Bug :bug:
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: Vertical Slider still logs the deprecated 'slider-vertical' warning in Chromium 132+対応中かも @jakesalvesen が 2 日前に担当しました。 オープンFluent UI react-components (v9) Needs: Triage :mag: Type: Bug :bug:
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
microsoft/fluentui#36945 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[Feature]: export getHashCode for Avatar from avatar.ts for Fluentv8 PersonaInitialsColor / PersonaCoin support対応中かも @ValentinaKozlova が 23 日前に担当しました。 オープンComponent: Avatar Fluent UI react-components (v9) From Shield Needs: Backlog review Type: Feature
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/fluentui#36802 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
microsoft/fluentui の issue をすべて見る
似ている issue
-
native
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
prime-radiant-inc/evener#4839 ·
メンテナーはふだん 1 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
processone/fluux-messenger#1790 ·
メンテナーはふだん 1 日以内に返信
-
🛣️ Infrastructure
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
opencrvs/opencrvs-core#14232 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
kunchenguid/gh-axi#220 ·
メンテナーはふだん 1 日以内に返信