mcpField
U
ui-testing

ui-testing

github.com/alinaqiテスト・品質711363 回インストール2 週間前に更新
リポジトリ

ui-testing について

生成されたコンポーネントの基本的なアクセシビリティを確認する開発者向けUI検証スキルです。チェックリスト、コントラスト確認、修正例と任意の自動テスト例を含みます。

主な機能

  1. 01リリース前の視認性チェックリスト
  2. 02コントラスト確認手順
  3. 03アクセシビリティの修正例
  4. 04任意の ESLint・Playwright 例

活用シーン

  1. 01ボタンとテキストのコントラスト確認
  2. 02タッチ対象サイズの確認
  3. 03フォーカス表示の欠落検出
  4. 04基本的な自動アクセシビリティ検査の追加

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/alinaqi/maggy --skill ui-testing

インストール後、Claude Code で/ui-testingを入力して読み込まれたか確認します。

詳細

UI 検証スキル

ui-web.md または ui-mobile.md と一緒に読み込みます

目的

生成された UI がアクセシビリティ基準を満たしているか、迅速に検証します。新しい UI コンポーネントを作成した後に、これらのチェックを実行してください。


出荷前チェックリスト

UI を出荷する前に必ず確認:
## Visibility Check
- [ ] All buttons have visible background OR border
- [ ] No text is same color as its background
- [ ] All text meets 4.5:1 contrast ratio
- [ ] Ghost/text buttons have visible borders

## Touch/Click Targets
- [ ] All buttons are minimum 44px height
- [ ] Icon buttons are minimum 44x44px
- [ ] Adequate spacing between clickable elements

## States
- [ ] Hover states visible (web)
- [ ] Pressed states visible (mobile)
- [ ] Focus rings on keyboard navigation
- [ ] Disabled states visually distinct (opacity 0.5)
- [ ] Loading states show indicators

## Dark Mode (if applicable)
- [ ] Text readable on dark backgrounds
- [ ] Borders visible in dark mode
- [ ] No gray-400 text on dark backgrounds

## Responsive (web)
- [ ] No horizontal scroll on mobile (320px)
- [ ] Content readable at all breakpoints
- [ ] Touch targets adequate on mobile

コントラストの簡易チェック

ブラウザーの DevTools を使用
1. Right-click element → Inspect
2. In Styles panel, click on color value
3. Look for contrast ratio display
4. Must show ✓ for AA compliance (4.5:1 for text)
オンラインツール
Tailwind の安全な組み合わせ
LIGHT MODE (on white bg):
✓ text-gray-900  (#111827) = 16:1
✓ text-gray-800  (#1F2937) = 12:1
✓ text-gray-700  (#374151) = 9:1
✓ text-gray-600  (#4B5563) = 6:1
✗ text-gray-500  (#6B7280) = 4.6:1 (barely)
✗ text-gray-400  (#9CA3AF) = 2.6:1 (FAILS)

DARK MODE (on gray-900 bg):
✓ text-white     (#FFFFFF) = 16:1
✓ text-gray-100  (#F3F4F6) = 13:1
✓ text-gray-200  (#E5E7EB) = 11:1
✓ text-gray-300  (#D1D5DB) = 8:1
✗ text-gray-400  (#9CA3AF) = 5:1 (barely)
✗ text-gray-500  (#6B7280) = 3:1 (FAILS)

よくある修正

見えないボタン
// PROBLEM: No visible boundary
<button className="text-gray-500">Click</button>

// FIX: Add background OR border
<button className="bg-gray-100 text-gray-900 px-4 py-3 rounded-lg">
  Click
</button>
// OR
<button className="border border-gray-300 text-gray-700 px-4 py-3 rounded-lg">
  Click
</button>
コントラストの低いテキスト
// PROBLEM: Light gray on white
<p className="text-gray-400">Secondary text</p>

// FIX: Use darker gray
<p className="text-gray-600">Secondary text</p>
フォーカス状態がない
// PROBLEM: Focus removed without replacement
<button className="outline-none">Submit</button>

// FIX: Add visible focus ring
<button className="outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2">
  Submit
</button>
タッチ領域が小さい
// PROBLEM: Too small for fingers
<button className="p-1 text-sm">×</button>

// FIX: Minimum 44px
<button className="w-11 h-11 flex items-center justify-center">×</button>
ダークモードが正しく動作しない
// PROBLEM: Same colors in both modes
<p className="text-gray-400">Text</p>

// FIX: Adjust for dark mode
<p className="text-gray-600 dark:text-gray-300">Text</p>

自動チェック(任意)

ESLint プラグイン
npm install -D eslint-plugin-jsx-a11y
// .eslintrc
{
  "extends": ["plugin:jsx-a11y/recommended"]
}
Playwright の簡易テスト
// e2e/accessibility.spec.ts
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';

test('no accessibility violations', async ({ page }) => {
  await page.goto('/');
  const results = await new AxeBuilder({ page }).analyze();
  expect(results.violations).toEqual([]);
});

本格的なテストを行うタイミング

次の場合は、包括的なビジュアルテスト(Playwright のスクリーンショット、Storybook)を追加してください:

  • コンポーネントライブラリを構築するとき
  • UI に複数の開発者が関わるとき
  • UI が頻繁に変更されるとき
  • デザインシステムへの準拠が必要なとき

個人プロジェクトや MVP では、上記のチェックリストで十分です。

コメント