Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

bug(aria/accordion): Enter/Space inside a panel toggles the accordion instead of activating the focused element

未關閉 適合新手
#34,011 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@agarwalU001 已經在處理了。

開始於 2026年10月25日。

  • #34012 來自 @agarwalU001 —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
72/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
angular, typescript

研究方向

從 issue 中指出的 src/aria/private/accordion/accordion.ts 裡的 keydown 處理器開始,並將其事件目標與 click 處理器的事件目標進行比較。使用連結的 StackBlitz 重現此行為,特別檢查面板控制項上的 Enter 和 Space,以及輸入欄位中的 Home。當這些按鍵在面板內容中正常運作,同時手風琴的鍵盤控制項在觸發器上仍正常運作時,即告完成。

由索引模型根據 Issue 內容生成。

描述

area: aria/accordion gemini-triaged needs triage
Is this a regression?
  • Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was

No response

Description

Pressing Enter on a link (or Space on a button) inside an expanded ngAccordionPanel collapses the panel instead of activating the link/button.

ngAccordionGroup handles keydown for the whole group, including panel content, and calls preventDefault() on Enter/Space, so the focused element never gets activated. Arrow keys and Home/End are affected too, e.g. Home in an input inside a panel moves focus to the trigger.

The click handler only reacts to events coming from a trigger (_findTriggerPattern), the keydown handler doesn't check that:
https://github.com/angular/components/blob/952685f9370ba718f832d745512db7c9a04e1bcd/src/aria/private/accordion/accordion.ts#L73-L97

Reproduction

StackBlitz link: https://stackblitz.com/edit/z5sxyaq6?file=src%2Fmain.ts

Steps to reproduce:

  1. Expand "Section 1".
  2. Tab to "Link inside panel" or "Button inside panel" and press Enter / Space.
  3. Expand it again, click into the input and press Home.
Expected Behavior

The link/button is activated (shows up in the log) and the panel stays open. Home moves the caret in the input.

Actual Behavior

The panel collapses, nothing is activated. Home moves focus to the trigger.

Environment
  • Angular: 22.2.3
  • CDK/Material: @angular/aria 22.2.4 (also 22.1.6)
  • Browser(s): Chrome 155
  • Operating System (e.g. Windows, macOS, Ubuntu): Linux
主要語言
TypeScript
星號
25k
分支
6.8k
平均合併
3 天 7 小時
30 天內合併 PR
59

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

angular/components 的其他 Issue

查看 angular/components 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。