disablePageTabIndex() sets aria-hidden on the focused calendar button, and enablePageTabIndex() never removes it
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
- #709 @arpitjain099 による — マージされずにクローズ
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- playwright, typescript
- 領域
- accessibility, frontend, testing
調査の方向性
picker.component.ts の DatepickerComponent のページロックメソッドから始め、次に test-app/e2e/datepicker.spec.ts の datepicker の Playwright カバレッジを実行し、Vitest と Playwright の境界について AGENTS.md を確認します。カレンダーのサブツリーが非表示になっておらず、以前の aria-hidden の状態が保持され、適切な場合には復元された属性が存在せず、実ブラウザーでのコンソールカバレッジで違反が報告されなければ、変更は完了です。
索引モデルが issue の本文から書いたものです。
説明
DatepickerComponent.disablePageTabIndex() stamps tabindex="-1" and aria-hidden="true" onto every focusable element on the page when the calendar opens — including the datepicker's own calendar button, which the user has just clicked and which the browser has focused. Chrome rejects the attribute and logs:
Blocked aria-hidden on an element because its descendant retained focus. The focus must
not be hidden from assistive technology users. [...] Consider using the inert attribute
instead, which will also prevent focus.
Element with focus: <span.fa fa-calendar>
Ancestor with aria-hidden: <span role="button" tabindex="-1" class="fa fa-calendar"
aria-expanded="true" data-sam-tabindex="0" aria-hidden="true">
Reproduced in Chromium on the /datepicker gallery route (added in #666), immediately after a real click on the calendar icon:
{
"activeElement": "<span role=\"button\" tabindex=\"-1\" class=\"fa fa-calendar\" aria-expanded=\"true\" data-sam-tabindex=\"0\" aria-hidden=\"true\">",
"iconAria": "true",
"iconTabindex": "-1"
}
Cause
The selector matches the component's own subtree:
_focusableString: string =
'a[href], area, button, select, textarea, *[tabindex], input:not([type="hidden"])';
picker.template.html gives the calendar button tabindex="0", so *[tabindex] selects it. disablePageTabIndex() then walks document.querySelectorAll(this._focusableString) with no exclusion for this component, hiding the trigger the user is standing on. The masked input inside sam-input-mask is hidden for the same reason.
Second defect in the same pair of methods
enablePageTabIndex() does not restore the prior aria-hidden state — it unconditionally sets aria-hidden="false":
el.removeAttribute("data-sam-tabindex");
el.setAttribute("aria-hidden", "false"); // should be removeAttribute
tabindex is correctly restored (data-sam-noinitial-tabindex tracks elements that had none and removes the attribute), but aria-hidden has no equivalent bookkeeping. So every focusable element on the page is left permanently carrying aria-hidden="false" after the first open/close cycle — DOM pollution that also destroys any aria-hidden an element legitimately had before the calendar opened.
Note test-app/e2e/datepicker.spec.ts currently asserts aria-hidden="false" as the restored state, with a comment explaining the tabindex asymmetry. Fixing this requires updating those assertions to expect the attribute to be absent.
Suggested direction
- Exclude the component's own subtree when disabling — e.g. skip any element where
this.wrapper/host.contains(el), or narrow_focusableStringand handle the trigger separately. - Record prior
aria-hiddenalongsidedata-sam-tabindex(mirroringdata-sam-noinitial-tabindex) and remove vs. restore accordingly. - Chrome's own suggestion — the
inertattribute on a wrapper — would replace both loops with one attribute and is worth evaluating, though it changes the DOM contract these two methods expose.
Scope note
These methods are public on DatepickerComponent and are the general page-locking mechanism for this component, so the fix is not datepicker-cosmetic — it affects the a11y of any page that opens the calendar. Independent of #681 (missing CSS): this reproduces regardless of stylesheets.
Acceptance criteria
- Opening the calendar does not set
aria-hidden="true"on the calendar button or any other element inside the datepicker - No
Blocked aria-hidden on an element because its descendant retained focuswarning in the browser console on open - Closing the calendar removes
aria-hiddenfrom elements that did not have it beforehand, rather than setting"false" - An element that legitimately had
aria-hidden="true"before the calendar opened still has it afterwards -
test-app/e2e/datepicker.spec.ts's restore assertions are updated accordingly (they currently expectaria-hidden="false") - Playwright coverage asserts the console produces no
aria-hiddenviolation — this is a real-focus/real-browser behaviour jsdom cannot reproduce, per AGENTS.md's Vitest/Playwright boundary
Context
Surfaced while manually testing #666 on the new /datepicker route. Pre-existing and unrelated to that PR's two-line fix (git diff on picker.component.ts touches only the @ViewChild decorator and the contains() comparison); kept separate to kept #666 scoped.
- 主要言語
- TypeScript
- スター
- 8
- フォーク
- 33
- 平均マージ
- 3日 21時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
GSA/sam-ui-elements のほかの issue
-
github_actions security
難易度 2/5 半日 初心者へのやさしさ 88/100
GSA/sam-ui-elements#761 ·
メンテナーはふだん 3 日以内に返信
-
tech-debt
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
GSA/sam-ui-elements#708 ·
メンテナーはふだん 3 日以内に返信
-
bugfix
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
GSA/sam-ui-elements#681 ·
メンテナーはふだん 3 日以内に返信
-
Burn down ESLint and Angular lint debt再び着手できるかも @fpigeonjr が 61 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンangular-upgrade maintenance
GSA/sam-ui-elements#580 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
sam-ui-elements pipeline modernization + Angular 19→21 upgrade (SAM Angular upgrade — 4th tracer bullet) — IAEMOD-61187再び着手できるかも @fpigeonjr が 73 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンangular-upgrade maintenance
GSA/sam-ui-elements#562 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
GSA/sam-ui-elements の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
ajv-validator/ajv#2689 ·
-
[Bug]: IME confirmation Enter can submit the SSH port-forward dialog対応中かも @seijikohara が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
home-assistant/frontend#55323 ·
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
lingdojo/kana-dojo#33188 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
self-driving
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信