Skip to content

🎨 Palette: フォームのバリデーション・エラーメッセージのアクセシビリティ改善#1026

Open
is0692vs wants to merge 2 commits into
stagingfrom
palette-form-a11y-9217948501152220070
Open

🎨 Palette: フォームのバリデーション・エラーメッセージのアクセシビリティ改善#1026
is0692vs wants to merge 2 commits into
stagingfrom
palette-form-a11y-9217948501152220070

Conversation

@is0692vs

@is0692vs is0692vs commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

💡 What: aria-describedbyaria-live="polite" を用いた動的な検証ステータスのアクセシビリティ改善、および送信エラーメッセージへの role="alert" の追加を行いました。
🎯 Why: 入力中に非同期で表示されるステータスメッセージ(「確認中...」「使用可能」など)がスクリーンリーダーによってスムーズに読み上げられるようになり、またエラー発生時には即座にユーザーへ通知されるようにするためです。
♿ Accessibility:

  • スラッグ入力欄に対し、aria-describedby で検証ステータスメッセージを紐付けました。
  • 検証ステータスメッセージのコンテナに aria-live="polite" を付与し、フォーカスを維持したまま変更を伝達できるようにしました。
  • フォーム送信時のエラーメッセージコンテナに role="alert" を付与しました。

PR created automatically by Jules for task 9217948501152220070 started by @is0692vs

Greptile Summary

スラッグ入力フィールドへの aria-describedby 付与、検証ステータスコンテナへの aria-live="polite" 追加、送信エラーメッセージへの role="alert" 追加により、フォームのアクセシビリティを向上させるPRです。aria-live 領域は常にDOMに存在するため設計は適切ですが、role="alert" の実装に改善の余地があります。

  • スラッグ検証ステータス(「確認中...」「使用可能」「使用済み」)に aria-live="polite" を設定し、フォーカスを維持しながらスクリーンリーダーへ変更を伝達できるようにした。
  • 送信エラーメッセージに role="alert" を追加したが、条件付きレンダリング({error && <p role="alert">...)のためVoiceOverなど一部スクリーンリーダーでDOM挿入タイミングの通知が届かない可能性がある。両ファイルで同様の問題が存在する。

Confidence Score: 3/5

アクセシビリティの改善が目的のPRだが、role="alert" の条件付きレンダリングにより一部スクリーンリーダーでエラー通知が届かない可能性があり、対処なしのマージは推奨しない。

aria-live 領域は常にDOMに存在させる設計で正しく機能するが、両フォームの送信エラー表示({error && <p role="alert">...)は要素がDOMに新規挿入されるタイミングで通知を行う実装になっている。WAI-ARIAの仕様上、ライブ領域はコンテンツ変化前からDOMに存在させるべきであり、VoiceOver(iOS/macOS)では動的挿入の場合に読み上げが発生しないことが知られている。アクセシビリティ改善を目的とするPRにおいてこの不完全な実装が両ファイルに存在するため、修正を推奨する。

両フォームページ(apps/web/src/app/collections/new/page.tsxapps/web/src/app/orgs/new/page.tsx)のエラーメッセージ実装を確認すること。

Important Files Changed

Filename Overview
apps/web/src/app/collections/new/page.tsx aria-describedby と aria-live="polite" の追加は適切。ただし role="alert" の条件付きレンダリングにより、一部のスクリーンリーダーでエラーが読み上げられないリスクがある。
apps/web/src/app/orgs/new/page.tsx collections/new と同様の問題:aria-live 領域は常にDOMに存在し良好だが、role="alert" が条件付きでDOMに追加されるためVoiceOverで動作しない可能性がある。
.Jules/palette.md 今回のアクセシビリティ改善内容を記録したラーニングエントリーの追加のみ。問題なし。

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ユーザーがスラッグ入力] --> B{バリデーション}
    B -- 無効な形式 --> C[slugStatus = invalid]
    B -- 有効な形式 --> D[400ms デバウンス待機]
    D --> E[slugStatus = checking]
    E --> F[API呼び出し]
    F -- 使用可能 --> G[slugStatus = available]
    F -- 使用済み --> H[slugStatus = taken]
    F -- エラー --> I[slugStatus = idle]

    C --> J["aria-live='polite' 領域\n常にDOM上に存在\n→ スクリーンリーダーに通知"]
    G --> J
    H --> J
    E --> J

    K[フォーム送信] --> L{バリデーション OK?}
    L -- NG --> M["role='alert' 要素\n条件付きレンダリング\n⚠️ VoiceOverで通知漏れリスク"]
    L -- OK --> N[API POST /api/collections or /api/orgs]
    N -- エラー --> M
    N -- 成功 --> O[ページ遷移]

    style J fill:#d4edda,stroke:#28a745
    style M fill:#fff3cd,stroke:#ffc107
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[ユーザーがスラッグ入力] --> B{バリデーション}
    B -- 無効な形式 --> C[slugStatus = invalid]
    B -- 有効な形式 --> D[400ms デバウンス待機]
    D --> E[slugStatus = checking]
    E --> F[API呼び出し]
    F -- 使用可能 --> G[slugStatus = available]
    F -- 使用済み --> H[slugStatus = taken]
    F -- エラー --> I[slugStatus = idle]

    C --> J["aria-live='polite' 領域\n常にDOM上に存在\n→ スクリーンリーダーに通知"]
    G --> J
    H --> J
    E --> J

    K[フォーム送信] --> L{バリデーション OK?}
    L -- NG --> M["role='alert' 要素\n条件付きレンダリング\n⚠️ VoiceOverで通知漏れリスク"]
    L -- OK --> N[API POST /api/collections or /api/orgs]
    N -- エラー --> M
    N -- 成功 --> O[ページ遷移]

    style J fill:#d4edda,stroke:#28a745
    style M fill:#fff3cd,stroke:#ffc107
Loading
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/web/src/app/collections/new/page.tsx:351
`role="alert"` の要素を条件付きでDOMに挿入すると、VoiceOver(iOS/macOS)など一部のスクリーンリーダーは挿入タイミングの通知を取りこぼす場合があります。WAI-ARIAのベストプラクティスでは、ライブ領域はコンテンツが変化する前からDOMに存在させ、内容のみを更新する方式が推奨されています。`error` が空文字のときも要素を常にレンダリングすることで、すべてのスクリーンリーダーで確実に読み上げられます。

```suggestion
        <p role="alert" aria-atomic="true" className="text-sm text-red-600">{error}</p>
```

### Issue 2 of 2
apps/web/src/app/orgs/new/page.tsx:224
`collections/new/page.tsx` と同じ問題です。`error` が存在するときだけ `<p role="alert">` をDOMに追加する条件付きレンダリングは、VoiceOverなどで通知が届かないリスクがあります。要素を常にDOMに置き、内容のみを切り替えることで信頼性が上がります。

```suggestion
        <p role="alert" aria-atomic="true" className="text-sm text-red-600">{error}</p>
```

Reviews (1): Last reviewed commit: "feat(a11y): improve form validation and ..." | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

is0692vs and others added 2 commits June 25, 2026 11:37
Release: staging -> main (2026-06-24 15:53)
- Add `aria-describedby` and `aria-live="polite"` to dynamic slug validation status
- Add `role="alert"` to form submission error messages
- Target: Collection and Organization creation forms

Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
open-shelf Ignored Ignored Jun 25, 2026 3:17pm

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@dosubot dosubot Bot added the enhancement New feature or request label Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@is0692vs, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 47 minutes and 40 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 43d418a0-301d-4fa7-a53f-1dff5b317129

📥 Commits

Reviewing files that changed from the base of the PR and between f00bd68 and 97c4c2c.

📒 Files selected for processing (3)
  • .Jules/palette.md
  • apps/web/src/app/collections/new/page.tsx
  • apps/web/src/app/orgs/new/page.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch palette-form-a11y-9217948501152220070

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot changed the base branch from main to staging June 25, 2026 15:18

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the accessibility of the creation forms for collections and organizations by adding appropriate ARIA attributes (aria-describedby, aria-live="polite", and role="alert") to dynamic validation statuses and error messages, and documents these practices in .Jules/palette.md. The review feedback recommends keeping the role="alert" container elements permanently in the DOM rather than conditionally mounting them, ensuring that screen readers reliably detect and announce the error messages when they are populated.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

</div>

{error && <p className="text-sm text-red-600">{error}</p>}
{error && <p role="alert" className="text-sm text-red-600">{error}</p>}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

role="alert"(または aria-live)を持つ要素を {error &&

...} のように動的にマウント(DOMに挿入)すると、一部のスクリーンリーダーが要素の追加を検知できず、エラーメッセージが読み上げられない場合があります。

アクセシビリティを確実に向上させるためには、role="alert" を持つコンテナ要素を常に DOM 上に存在させておき、その中身(テキスト)のみを動的に更新することが推奨されます。

        <p role="alert" className="text-sm text-red-600">
          {error}
        </p>

</div>

{error && <p className="text-sm text-red-600">{error}</p>}
{error && <p role="alert" className="text-sm text-red-600">{error}</p>}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

role="alert"(または aria-live)を持つ要素を {error &&

...} のように動的にマウントすると、一部のスクリーンリーダーでエラーメッセージの発生が正しくアナウンスされないことがあります。

コンテナとなる

要素は常に DOM にレンダリングしておき、エラーテキストのみを動的に流し込むように変更することで、より確実にスクリーンリーダーに通知することができます。

        <p role="alert" className="text-sm text-red-600">
          {error}
        </p>

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

</div>

{error && <p className="text-sm text-red-600">{error}</p>}
{error && <p role="alert" className="text-sm text-red-600">{error}</p>}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 role="alert" の要素を条件付きでDOMに挿入すると、VoiceOver(iOS/macOS)など一部のスクリーンリーダーは挿入タイミングの通知を取りこぼす場合があります。WAI-ARIAのベストプラクティスでは、ライブ領域はコンテンツが変化する前からDOMに存在させ、内容のみを更新する方式が推奨されています。error が空文字のときも要素を常にレンダリングすることで、すべてのスクリーンリーダーで確実に読み上げられます。

Suggested change
{error && <p role="alert" className="text-sm text-red-600">{error}</p>}
<p role="alert" aria-atomic="true" className="text-sm text-red-600">{error}</p>
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/src/app/collections/new/page.tsx
Line: 351

Comment:
`role="alert"` の要素を条件付きでDOMに挿入すると、VoiceOver(iOS/macOS)など一部のスクリーンリーダーは挿入タイミングの通知を取りこぼす場合があります。WAI-ARIAのベストプラクティスでは、ライブ領域はコンテンツが変化する前からDOMに存在させ、内容のみを更新する方式が推奨されています。`error` が空文字のときも要素を常にレンダリングすることで、すべてのスクリーンリーダーで確実に読み上げられます。

```suggestion
        <p role="alert" aria-atomic="true" className="text-sm text-red-600">{error}</p>
```

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

</div>

{error && <p className="text-sm text-red-600">{error}</p>}
{error && <p role="alert" className="text-sm text-red-600">{error}</p>}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 collections/new/page.tsx と同じ問題です。error が存在するときだけ <p role="alert"> をDOMに追加する条件付きレンダリングは、VoiceOverなどで通知が届かないリスクがあります。要素を常にDOMに置き、内容のみを切り替えることで信頼性が上がります。

Suggested change
{error && <p role="alert" className="text-sm text-red-600">{error}</p>}
<p role="alert" aria-atomic="true" className="text-sm text-red-600">{error}</p>
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/src/app/orgs/new/page.tsx
Line: 224

Comment:
`collections/new/page.tsx` と同じ問題です。`error` が存在するときだけ `<p role="alert">` をDOMに追加する条件付きレンダリングは、VoiceOverなどで通知が届かないリスクがあります。要素を常にDOMに置き、内容のみを切り替えることで信頼性が上がります。

```suggestion
        <p role="alert" aria-atomic="true" className="text-sm text-red-600">{error}</p>
```

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant