Slider (Multi-Thumb)
指定された範囲内で範囲を選択するための2つのつまみを持つスライダー。この Astro 実装はクライアントサイドのインタラクティビティに Web Components を使用しています。
デモ
アクセシビリティ
WAI-ARIA ロール
| ロール | 対象要素 | 説明 |
|---|---|---|
slider | 下限つまみ要素 | 範囲の下限を選択するためのスライダーとして要素を識別します。 |
slider | 上限つまみ要素 | 範囲の上限を選択するためのスライダーとして要素を識別します。 |
group | コンテナ要素 | 2つのスライダーをグループ化し、共通のラベルに関連付けます。 |
各つまみは独自のARIA属性を持つ独立した slider 要素です。
group ロールが2つのスライダー間のセマンティックな関係を確立します。
WAI-ARIA プロパティ
aria-valuenow (必須)
各つまみの現在の数値を示します。ユーザーが値を変更すると動的に更新されます。
| 型 | Number |
| 必須 | はい |
| 範囲 | aria-valuemin と aria-valuemax
の間である必要があります
|
aria-valuemin (必須)
動的な境界: APG仕様に従い、一方のスライダーの範囲が他方の値に依存する場合、これらの属性は動的に更新する必要があります:
| つまみ | aria-valuemin | aria-valuemax |
|---|---|---|
| 下限つまみ | 静的(絶対最小値) | 動的(上限値 - minDistance) |
| 上限つまみ | 動的(下限値 + minDistance) | 静的(絶対最大値) |
このアプローチにより、支援技術ユーザーに各つまみの実際の許容範囲を正しく伝えることができ、HomeキーとEndキーの動作の予測可能性が向上します。
aria-valuemax (必須)
aria-valuetext
現在の値の人間が読めるテキスト代替を提供します。数値だけでは十分な意味を伝えられない場合に使用します。
| 型 | String |
| 必須 | いいえ(値にコンテキストが必要な場合は推奨) |
| 例 | "$20", "$80", "20% - 80%" |
aria-orientation
スライダーの向きを指定します。垂直スライダーの場合のみ "vertical" に設定します。水平の場合は省略します(デフォルト)。
| 型 | "horizontal" | "vertical" |
| 必須 | いいえ |
| デフォルト | horizontal(暗黙的) |
aria-disabled
スライダーが無効でインタラクティブではないことを示します。
| 型 | true | undefined |
| 必須 | いいえ |
キーボードサポート
| キー | アクション |
|---|---|
| Tab | つまみ間でフォーカスを移動(下限から上限へ) |
| Shift + Tab | つまみ間でフォーカスを移動(上限から下限へ) |
| Right Arrow | 値を1ステップ増加させる |
| Up Arrow | 値を1ステップ増加させる |
| Left Arrow | 値を1ステップ減少させる |
| Down Arrow | 値を1ステップ減少させる |
| Home | つまみを許容最小値に設定(上限つまみは動的) |
| End | つまみを許容最大値に設定(下限つまみは動的) |
| Page Up | 値を大きいステップで増加させる(デフォルト: step * 10) |
| Page Down | 値を大きいステップで減少させる(デフォルト: step * 10) |
衝突防止
マルチサムスライダーは、つまみが互いに交差しないようにします:
- 下限つまみ - (上限値 - minDistance)を超えられない
- 上限つまみ - (下限値 + minDistance)を下回れない
- minDistance - つまみ間の設定可能な最小ギャップ(デフォルト: 0)
アクセシブルな名前
マルチサムスライダーでは、2つのつまみを区別するために慎重なラベル付けが必要です。この実装は以下のアプローチをサポートしています:
- 表示されるグループラベル -
labelプロパティを使用してスライダーグループの表示ラベルを提供 -
aria-label(タプル)- 各つまみに個別のラベルを提供(例: ["最小価格", "最大価格"]) -
aria-labelledby(タプル)- 外部要素を各つまみのラベルとして参照 -
getAriaLabel関数 - つまみのインデックスに基づいた動的なラベル生成
フォーカス管理
この実装でのフォーカス動作:
- タブ順序 - 両方のつまみがタブ順序に含まれる(tabindex="0")
- 固定順序 - 値に関係なく、下限つまみが常にタブ順序で先に来る
- トラッククリック - トラックをクリックすると最も近いつまみが移動してフォーカスされる
ポインター操作
この実装はマウスとタッチ操作をサポートしています:
- トラックをクリック: 最も近いつまみをクリック位置に移動
- つまみをドラッグ: ドラッグ中の連続的な調整が可能
- ポインターキャプチャ: ポインターがスライダーの外に出てもインタラクションを維持
ビジュアルデザイン
この実装は、アクセシブルなビジュアルデザインのためのWCAGガイドラインに従っています:
- フォーカスインジケーター: 各つまみ要素に可視のフォーカスリング
- 範囲インジケーター: つまみ間の選択範囲の視覚的表現
- ホバー状態: ホバー時の視覚的フィードバック
- 無効状態: スライダーが無効な時の明確な視覚的表示
- 強制カラーモード: Windowsハイコントラストモードでのアクセシビリティのためにシステムカラーを使用
参考資料
ソースコード
---
/**
* APG Multi-Thumb Slider Pattern - Astro Implementation
*
* A control that allows users to select a range of values using two thumbs.
* Uses Web Components for interactive behavior.
*
* @see https://www.w3.org/WAI/ARIA/apg/patterns/slider-multithumb/
*/
export interface Props {
/** Default values [lowerValue, upperValue] */
defaultValue?: [number, number];
/** Minimum value (default: 0) */
min?: number;
/** Maximum value (default: 100) */
max?: number;
/** Step increment (default: 1) */
step?: number;
/** Large step for PageUp/PageDown */
largeStep?: number;
/** Minimum distance between thumbs (default: 0) */
minDistance?: number;
/** Slider orientation */
orientation?: 'horizontal' | 'vertical';
/** Whether slider is disabled */
disabled?: boolean;
/** Show value text (default: true) */
showValues?: boolean;
/** Visible label text for the group */
label?: string;
/** Format pattern for value display (e.g., "{value}") */
format?: string;
/** Slider id */
id?: string;
/** Additional CSS class */
class?: string;
/** Accessible label for lower thumb */
'aria-label-lower'?: string;
/** Accessible label for upper thumb */
'aria-label-upper'?: string;
/** Reference to external label element for lower thumb */
'aria-labelledby-lower'?: string;
/** Reference to external label element for upper thumb */
'aria-labelledby-upper'?: string;
/** Reference to description element (shared or per thumb) */
'aria-describedby'?: string;
/** Test id */
'data-testid'?: string;
}
const {
defaultValue,
min = 0,
max = 100,
step = 1,
largeStep,
minDistance = 0,
orientation = 'horizontal',
disabled = false,
showValues = true,
label,
format,
id,
class: className = '',
'aria-label-lower': ariaLabelLower,
'aria-label-upper': ariaLabelUpper,
'aria-labelledby-lower': ariaLabelledbyLower,
'aria-labelledby-upper': ariaLabelledbyUpper,
'aria-describedby': ariaDescribedby,
'data-testid': dataTestId,
} = Astro.props;
// Utility functions
const clamp = (val: number, minVal: number, maxVal: number): number => {
return Math.min(maxVal, Math.max(minVal, val));
};
const roundToStep = (val: number, stepVal: number, minVal: number): number => {
const steps = Math.round((val - minVal) / stepVal);
const result = minVal + steps * stepVal;
const decimalPlaces = (stepVal.toString().split('.')[1] || '').length;
return Number(result.toFixed(decimalPlaces));
};
// Normalize values
const normalizeValues = (
values: [number, number],
minVal: number,
maxVal: number,
stepVal: number,
minDist: number
): [number, number] => {
let [lower, upper] = values;
const effectiveMinDistance = Math.min(minDist, maxVal - minVal);
lower = roundToStep(lower, stepVal, minVal);
upper = roundToStep(upper, stepVal, minVal);
lower = clamp(lower, minVal, maxVal - effectiveMinDistance);
upper = clamp(upper, minVal + effectiveMinDistance, maxVal);
if (lower > upper - effectiveMinDistance) {
lower = upper - effectiveMinDistance;
}
return [lower, upper];
};
// Calculate initial values
const initialValues = normalizeValues(defaultValue ?? [min, max], min, max, step, minDistance);
// Calculate percentages for visual display
const lowerPercent = max === min ? 0 : ((initialValues[0] - min) / (max - min)) * 100;
const upperPercent = max === min ? 100 : ((initialValues[1] - min) / (max - min)) * 100;
// Dynamic bounds
const effectiveMinDistance = Math.min(minDistance, max - min);
const lowerBoundsMax = initialValues[1] - effectiveMinDistance;
const upperBoundsMin = initialValues[0] + effectiveMinDistance;
// Format value helper
const formatValue = (value: number, formatStr?: string): string => {
if (!formatStr) return String(value);
return formatStr
.replace('{value}', String(value))
.replace('{min}', String(min))
.replace('{max}', String(max));
};
// Display text
const lowerDisplayText = formatValue(initialValues[0], format);
const upperDisplayText = formatValue(initialValues[1], format);
// Generate unique label ID
const groupLabelId = label
? `slider-multithumb-label-${Math.random().toString(36).slice(2, 9)}`
: undefined;
const isVertical = orientation === 'vertical';
const effectiveLargeStep = largeStep ?? step * 10;
---
<apg-slider-multithumb
data-min={min}
data-max={max}
data-step={step}
data-large-step={effectiveLargeStep}
data-min-distance={minDistance}
data-orientation={orientation}
data-disabled={disabled}
data-format={format}
>
<div
role={label ? 'group' : undefined}
aria-labelledby={label ? groupLabelId : undefined}
class={`apg-slider-multithumb ${isVertical ? 'apg-slider-multithumb--vertical' : ''} ${disabled ? 'apg-slider-multithumb--disabled' : ''} ${className}`.trim()}
id={id}
data-testid={dataTestId}
>
{
label && (
<span id={groupLabelId} class="apg-slider-multithumb-label">
{label}
</span>
)
}
<div
class="apg-slider-multithumb-track"
style={`--slider-lower: ${lowerPercent}%; --slider-upper: ${upperPercent}%`}
>
<div class="apg-slider-multithumb-range" aria-hidden="true"></div>
<!-- Lower thumb -->
<div
role="slider"
tabindex={disabled ? -1 : 0}
aria-valuenow={initialValues[0]}
aria-valuemin={min}
aria-valuemax={lowerBoundsMax}
aria-valuetext={format ? formatValue(initialValues[0], format) : undefined}
aria-label={ariaLabelLower}
aria-labelledby={ariaLabelledbyLower}
aria-orientation={isVertical ? 'vertical' : undefined}
aria-disabled={disabled ? true : undefined}
aria-describedby={ariaDescribedby}
class="apg-slider-multithumb-thumb apg-slider-multithumb-thumb--lower"
style={isVertical ? `bottom: ${lowerPercent}%` : `left: ${lowerPercent}%`}
data-thumb-index="0"
>
<span class="apg-slider-multithumb-tooltip" aria-hidden="true">
{ariaLabelLower}
</span>
</div>
<!-- Upper thumb -->
<div
role="slider"
tabindex={disabled ? -1 : 0}
aria-valuenow={initialValues[1]}
aria-valuemin={upperBoundsMin}
aria-valuemax={max}
aria-valuetext={format ? formatValue(initialValues[1], format) : undefined}
aria-label={ariaLabelUpper}
aria-labelledby={ariaLabelledbyUpper}
aria-orientation={isVertical ? 'vertical' : undefined}
aria-disabled={disabled ? true : undefined}
aria-describedby={ariaDescribedby}
class="apg-slider-multithumb-thumb apg-slider-multithumb-thumb--upper"
style={isVertical ? `bottom: ${upperPercent}%` : `left: ${upperPercent}%`}
data-thumb-index="1"
>
<span class="apg-slider-multithumb-tooltip" aria-hidden="true">
{ariaLabelUpper}
</span>
</div>
</div>
{
showValues && (
<div class="apg-slider-multithumb-values" aria-hidden="true">
<span class="apg-slider-multithumb-value apg-slider-multithumb-value--lower">
{lowerDisplayText}
</span>
<span class="apg-slider-multithumb-value-separator"> - </span>
<span class="apg-slider-multithumb-value apg-slider-multithumb-value--upper">
{upperDisplayText}
</span>
</div>
)
}
</div>
</apg-slider-multithumb>
<script>
class ApgSliderMultithumb extends HTMLElement {
private lowerThumb: HTMLElement | null = null;
private upperThumb: HTMLElement | null = null;
private track: HTMLElement | null = null;
private rangeIndicator: HTMLElement | null = null;
private lowerValueDisplay: HTMLElement | null = null;
private upperValueDisplay: HTMLElement | null = null;
private activeThumbIndex: number | null = null;
connectedCallback() {
this.lowerThumb = this.querySelector('[data-thumb-index="0"]');
this.upperThumb = this.querySelector('[data-thumb-index="1"]');
this.track = this.querySelector('.apg-slider-multithumb-track');
this.rangeIndicator = this.querySelector('.apg-slider-multithumb-range');
this.lowerValueDisplay = this.querySelector('.apg-slider-multithumb-value--lower');
this.upperValueDisplay = this.querySelector('.apg-slider-multithumb-value--upper');
// Bind event handlers for lower thumb
if (this.lowerThumb) {
this.lowerThumb.addEventListener('keydown', this.handleKeyDown.bind(this, 0));
this.lowerThumb.addEventListener('pointerdown', this.handlePointerDown.bind(this, 0));
this.lowerThumb.addEventListener('pointermove', this.handlePointerMove.bind(this, 0));
this.lowerThumb.addEventListener('pointerup', this.handlePointerUp.bind(this, 0));
}
// Bind event handlers for upper thumb
if (this.upperThumb) {
this.upperThumb.addEventListener('keydown', this.handleKeyDown.bind(this, 1));
this.upperThumb.addEventListener('pointerdown', this.handlePointerDown.bind(this, 1));
this.upperThumb.addEventListener('pointermove', this.handlePointerMove.bind(this, 1));
this.upperThumb.addEventListener('pointerup', this.handlePointerUp.bind(this, 1));
}
// Track click
if (this.track) {
this.track.addEventListener('click', this.handleTrackClick.bind(this));
}
}
disconnectedCallback() {
// Note: Event listeners are automatically removed when element is removed
}
private get min(): number {
return Number(this.dataset.min) || 0;
}
private get max(): number {
return Number(this.dataset.max) || 100;
}
private get step(): number {
return Number(this.dataset.step) || 1;
}
private get largeStep(): number {
return Number(this.dataset.largeStep) || this.step * 10;
}
private get minDistance(): number {
return Number(this.dataset.minDistance) || 0;
}
private get effectiveMinDistance(): number {
return Math.min(this.minDistance, this.max - this.min);
}
private get isVertical(): boolean {
return this.dataset.orientation === 'vertical';
}
private get isDisabled(): boolean {
return this.dataset.disabled === 'true';
}
private get format(): string | undefined {
return this.dataset.format;
}
private formatValue(value: number): string {
const fmt = this.format;
if (!fmt) return String(value);
return fmt
.replace('{value}', String(value))
.replace('{min}', String(this.min))
.replace('{max}', String(this.max));
}
private getThumb(index: number): HTMLElement | null {
return index === 0 ? this.lowerThumb : this.upperThumb;
}
private getValue(index: number): number {
const thumb = this.getThumb(index);
return Number(thumb?.getAttribute('aria-valuenow')) || this.min;
}
private getValues(): [number, number] {
return [this.getValue(0), this.getValue(1)];
}
private getThumbBounds(index: number): { min: number; max: number } {
const values = this.getValues();
if (index === 0) {
return {
min: this.min,
max: values[1] - this.effectiveMinDistance,
};
} else {
return {
min: values[0] + this.effectiveMinDistance,
max: this.max,
};
}
}
private clamp(val: number, minVal: number, maxVal: number): number {
return Math.min(maxVal, Math.max(minVal, val));
}
private roundToStep(val: number): number {
const steps = Math.round((val - this.min) / this.step);
const result = this.min + steps * this.step;
const decimalPlaces = (this.step.toString().split('.')[1] || '').length;
return Number(result.toFixed(decimalPlaces));
}
private updateValue(index: number, newValue: number) {
if (this.isDisabled) return;
const thumb = this.getThumb(index);
if (!thumb) return;
const bounds = this.getThumbBounds(index);
const clampedValue = this.clamp(this.roundToStep(newValue), bounds.min, bounds.max);
const currentValue = this.getValue(index);
if (clampedValue === currentValue) return;
// Update ARIA
thumb.setAttribute('aria-valuenow', String(clampedValue));
// Update aria-valuetext if format is provided
const formattedValue = this.formatValue(clampedValue);
if (this.format) {
thumb.setAttribute('aria-valuetext', formattedValue);
}
// Update visual position
const percentage = ((clampedValue - this.min) / (this.max - this.min)) * 100;
if (this.isVertical) {
thumb.style.bottom = `${percentage}%`;
} else {
thumb.style.left = `${percentage}%`;
}
// Update range indicator
const values = this.getValues();
const lowerPercent = ((values[0] - this.min) / (this.max - this.min)) * 100;
const upperPercent = ((values[1] - this.min) / (this.max - this.min)) * 100;
if (this.track) {
this.track.style.setProperty('--slider-lower', `${lowerPercent}%`);
this.track.style.setProperty('--slider-upper', `${upperPercent}%`);
}
// Update value display
const valueDisplay = index === 0 ? this.lowerValueDisplay : this.upperValueDisplay;
if (valueDisplay) {
valueDisplay.textContent = formattedValue;
}
// Update dynamic bounds on the other thumb
this.updateOtherThumbBounds(index);
// Dispatch event
this.dispatchEvent(
new CustomEvent('valuechange', {
detail: { values: this.getValues(), activeThumbIndex: index },
bubbles: true,
})
);
}
private updateOtherThumbBounds(changedIndex: number) {
const otherIndex = changedIndex === 0 ? 1 : 0;
const otherThumb = this.getThumb(otherIndex);
if (!otherThumb) return;
const bounds = this.getThumbBounds(otherIndex);
otherThumb.setAttribute(
otherIndex === 0 ? 'aria-valuemax' : 'aria-valuemin',
String(otherIndex === 0 ? bounds.max : bounds.min)
);
}
private getValueFromPointer(clientX: number, clientY: number): number {
if (!this.track) return this.getValue(0);
const rect = this.track.getBoundingClientRect();
if (rect.width === 0 && rect.height === 0) {
return this.getValue(0);
}
let percent: number;
if (this.isVertical) {
if (rect.height === 0) return this.getValue(0);
percent = 1 - (clientY - rect.top) / rect.height;
} else {
if (rect.width === 0) return this.getValue(0);
percent = (clientX - rect.left) / rect.width;
}
return this.min + percent * (this.max - this.min);
}
private handleKeyDown(index: number, event: KeyboardEvent) {
if (this.isDisabled) return;
const bounds = this.getThumbBounds(index);
const currentValue = this.getValue(index);
let newValue = currentValue;
switch (event.key) {
case 'ArrowRight':
case 'ArrowUp':
newValue = currentValue + this.step;
break;
case 'ArrowLeft':
case 'ArrowDown':
newValue = currentValue - this.step;
break;
case 'Home':
newValue = bounds.min;
break;
case 'End':
newValue = bounds.max;
break;
case 'PageUp':
newValue = currentValue + this.largeStep;
break;
case 'PageDown':
newValue = currentValue - this.largeStep;
break;
default:
return;
}
event.preventDefault();
this.updateValue(index, newValue);
}
private handlePointerDown(index: number, event: PointerEvent) {
if (this.isDisabled) return;
const thumb = this.getThumb(index);
if (!thumb) return;
event.preventDefault();
if (typeof thumb.setPointerCapture === 'function') {
thumb.setPointerCapture(event.pointerId);
}
this.activeThumbIndex = index;
thumb.focus();
}
private handlePointerMove(index: number, event: PointerEvent) {
const thumb = this.getThumb(index);
if (!thumb) return;
const hasCapture =
typeof thumb.hasPointerCapture === 'function'
? thumb.hasPointerCapture(event.pointerId)
: this.activeThumbIndex === index;
if (!hasCapture) return;
const newValue = this.getValueFromPointer(event.clientX, event.clientY);
this.updateValue(index, newValue);
}
private handlePointerUp(index: number, event: PointerEvent) {
const thumb = this.getThumb(index);
if (thumb && typeof thumb.releasePointerCapture === 'function') {
try {
thumb.releasePointerCapture(event.pointerId);
} catch {
// Ignore
}
}
this.activeThumbIndex = null;
// Dispatch commit event
this.dispatchEvent(
new CustomEvent('valuecommit', {
detail: { values: this.getValues() },
bubbles: true,
})
);
}
private handleTrackClick(event: MouseEvent) {
if (this.isDisabled || event.target === this.lowerThumb || event.target === this.upperThumb)
return;
const clickValue = this.getValueFromPointer(event.clientX, event.clientY);
const values = this.getValues();
// Determine which thumb to move (nearest, prefer lower on tie)
const distToLower = Math.abs(clickValue - values[0]);
const distToUpper = Math.abs(clickValue - values[1]);
const targetIndex = distToLower <= distToUpper ? 0 : 1;
this.updateValue(targetIndex, clickValue);
this.getThumb(targetIndex)?.focus();
}
// Public method to update values programmatically
setValues(lowerValue: number, upperValue: number) {
this.updateValue(0, lowerValue);
this.updateValue(1, upperValue);
}
}
if (!customElements.get('apg-slider-multithumb')) {
customElements.define('apg-slider-multithumb', ApgSliderMultithumb);
}
</script> 使い方
---
import MultiThumbSlider from './MultiThumbSlider.astro';
---
<!-- 基本的な使用方法(可視ラベルとaria-labelプロパティ) -->
<MultiThumbSlider
defaultValue={[20, 80]}
label="価格範囲"
aria-label-lower="最小価格"
aria-label-upper="最大価格"
/>
<!-- 表示とaria-valuetextのフォーマット -->
<MultiThumbSlider
defaultValue={[25, 75]}
label="温度"
format="{value}°C"
aria-label-lower="最小温度"
aria-label-upper="最大温度"
/>
<!-- つまみが近づきすぎないようにminDistanceを設定 -->
<MultiThumbSlider
defaultValue={[30, 70]}
minDistance={10}
label="予算"
format="${value}"
aria-label-lower="最小予算"
aria-label-upper="最大予算"
/>
<!-- JavaScriptでイベントを監視 -->
<MultiThumbSlider
id="my-slider"
defaultValue={[20, 80]}
label="範囲"
aria-label-lower="下限"
aria-label-upper="上限"
/>
<script>
const slider = document.getElementById('my-slider');
slider?.addEventListener('valuechange', (e) => {
const { values, activeThumbIndex } = e.detail;
console.log('変更:', values, 'アクティブなつまみ:', activeThumbIndex);
});
slider?.addEventListener('valuecommit', (e) => {
const { values } = e.detail;
console.log('確定:', values);
});
</script> API
プロパティ
| プロパティ | 型 | デフォルト | 説明 |
|---|---|---|---|
defaultValue | [number, number] | [min, max] | 2つのつまみの初期値 |
min | number | 0 | 最小値 |
max | number | 100 | 最大値 |
step | number | 1 | ステップ増分 |
minDistance | number | 0 | つまみ間の最小距離 |
disabled | boolean | false | スライダーが無効化されているかどうか |
label | string | - | スライダーグループの可視ラベル |
format | string | - | 表示のフォーマットパターン |
aria-label-lower | string | - | 下限つまみのアクセシブルなラベル |
aria-label-upper | string | - | 上限つまみのアクセシブルなラベル |
カスタムイベント
| イベント | 詳細 | 説明 |
|---|---|---|
valuechange | {values, activeThumbIndex} | いずれかの値が変更されたときに発火 |
valuecommit | {values} | 操作が終了したときに発火 |
テスト
テストは、ARIA属性、キーボードインタラクション、衝突防止、マルチサムスライダーのアクセシビリティ要件のAPG準拠を検証します。
テストカテゴリ
高優先度: ARIA 構造
| テスト | 説明 |
|---|---|
two slider elements | コンテナにrole="slider"を持つ要素がちょうど2つある |
role="group" | スライダーがaria-labelledbyを持つグループに含まれている |
aria-valuenow | 両方のつまみに正しい初期値が設定されている |
static aria-valuemin | 下限つまみに静的な最小値(絶対最小値)がある |
static aria-valuemax | 上限つまみに静的な最大値(絶対最大値)がある |
dynamic aria-valuemax | 下限つまみの最大値が上限つまみの値に依存する |
dynamic aria-valuemin | 上限つまみの最小値が下限つまみの値に依存する |
高優先度: 動的な境界の更新
| テスト | 説明 |
|---|---|
lower -> upper bound | 下限つまみを動かすと上限つまみのaria-valueminが更新される |
upper -> lower bound | 上限つまみを動かすと下限つまみのaria-valuemaxが更新される |
高優先度: キーボードインタラクション
| テスト | 説明 |
|---|---|
Arrow Right/Up | 値を1ステップ増加 |
Arrow Left/Down | 値を1ステップ減少 |
Home (lower) | 下限つまみを絶対最小値に設定 |
End (lower) | 下限つまみを動的最大値に設定(上限 - minDistance) |
Home (upper) | 上限つまみを動的最小値に設定(下限 + minDistance) |
End (upper) | 上限つまみを絶対最大値に設定 |
Page Up/Down | 値を大きいステップで増加/減少 |
高優先度: 衝突防止
| テスト | 説明 |
|---|---|
lower cannot exceed upper | 下限つまみが(上限 - minDistance)で停止する |
upper cannot go below lower | 上限つまみが(下限 + minDistance)で停止する |
rapid key presses | 矢印キーを連打してもつまみが交差しない |
高優先度: フォーカス管理
| テスト | 説明 |
|---|---|
Tab order | Tabで下限から上限つまみに移動 |
Shift+Tab order | Shift+Tabで上限から下限つまみに移動 |
tabindex="0" | 両方のつまみにtabindex="0"がある(常にタブ順序に含まれる) |
中優先度: aria-valuetextの更新
| テスト | 説明 |
|---|---|
lower thumb update | 下限つまみの値が変更されるとaria-valuetextが更新される |
upper thumb update | 上限つまみの値が変更されるとaria-valuetextが更新される |
中優先度: アクセシビリティ
| テスト | 説明 |
|---|---|
axe violations (container) | コンテナにアクセシビリティ違反がない |
axe violations (sliders) | 各スライダー要素にアクセシビリティ違反がない |
低優先度: フレームワーク間の一貫性
| テスト | 説明 |
|---|---|
render two sliders | すべてのフレームワークがちょうど2つのスライダー要素をレンダリング |
consistent initial values | すべてのフレームワークで同一の初期aria-valuenow値 |
keyboard navigation | すべてのフレームワークで同一のキーボードナビゲーション |
collision prevention | すべてのフレームワークでつまみの交差を防止 |
テストコード例
以下は実際のE2Eテストファイル(e2e/slider-multithumb.spec.ts)です。
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
/**
* E2E Tests for Multi-Thumb Slider Pattern
*
* A slider with two thumbs that allows users to select a range of values.
* Each thumb uses role="slider" with dynamic aria-valuemin/aria-valuemax
* based on the other thumb's position.
*
* APG Reference: https://www.w3.org/WAI/ARIA/apg/patterns/slider-multithumb/
*/
const frameworks = ['react', 'vue', 'svelte', 'astro'] as const;
// ============================================
// Helper Functions
// ============================================
const getBasicSliderContainer = (page: import('@playwright/test').Page) => {
return page.getByTestId('basic-slider');
};
const getSliders = (page: import('@playwright/test').Page) => {
return getBasicSliderContainer(page).getByRole('slider');
};
const getSliderByLabel = (page: import('@playwright/test').Page, label: string) => {
return getBasicSliderContainer(page).getByRole('slider', { name: label });
};
// ============================================
// Framework-specific Tests
// ============================================
for (const framework of frameworks) {
test.describe(`MultiThumbSlider (${framework})`, () => {
test.beforeEach(async ({ page }) => {
await page.goto(`patterns/slider-multithumb/${framework}/demo/`);
await getSliders(page).first().waitFor();
// Wait for hydration - sliders should have aria-valuenow
const firstSlider = getSliders(page).first();
await expect
.poll(async () => {
const valuenow = await firstSlider.getAttribute('aria-valuenow');
return valuenow !== null;
})
.toBe(true);
});
// ------------------------------------------
// 🔴 High Priority: APG ARIA Structure
// ------------------------------------------
test.describe('APG: ARIA Structure', () => {
test('has two slider elements', async ({ page }) => {
const sliders = getSliders(page);
await expect(sliders).toHaveCount(2);
});
test('lower thumb has role="slider"', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
await expect(lowerThumb).toHaveRole('slider');
});
test('upper thumb has role="slider"', async ({ page }) => {
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await expect(upperThumb).toHaveRole('slider');
});
test('lower thumb has correct initial aria-valuenow', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const valuenow = await lowerThumb.getAttribute('aria-valuenow');
expect(valuenow).toBe('20');
});
test('upper thumb has correct initial aria-valuenow', async ({ page }) => {
const upperThumb = getSliderByLabel(page, 'Maximum Price');
const valuenow = await upperThumb.getAttribute('aria-valuenow');
expect(valuenow).toBe('80');
});
test('lower thumb has static aria-valuemin (absolute min)', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
await expect(lowerThumb).toHaveAttribute('aria-valuemin', '0');
});
test('upper thumb has static aria-valuemax (absolute max)', async ({ page }) => {
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await expect(upperThumb).toHaveAttribute('aria-valuemax', '100');
});
test('lower thumb has dynamic aria-valuemax based on upper thumb', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
// Upper thumb is at 80, so lower thumb max should be 80 (or 80 - minDistance)
const valuemax = await lowerThumb.getAttribute('aria-valuemax');
expect(Number(valuemax)).toBeLessThanOrEqual(80);
});
test('upper thumb has dynamic aria-valuemin based on lower thumb', async ({ page }) => {
const upperThumb = getSliderByLabel(page, 'Maximum Price');
// Lower thumb is at 20, so upper thumb min should be 20 (or 20 + minDistance)
const valuemin = await upperThumb.getAttribute('aria-valuemin');
expect(Number(valuemin)).toBeGreaterThanOrEqual(20);
});
test('sliders are contained in group with label', async ({ page }) => {
const group = page.getByRole('group', { name: 'Price Range' });
await expect(group).toBeVisible();
});
});
// ------------------------------------------
// 🔴 High Priority: Dynamic Bounds Update
// ------------------------------------------
test.describe('APG: Dynamic Bounds Update', () => {
test('moving lower thumb updates upper thumb aria-valuemin', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await lowerThumb.click();
await page.keyboard.press('ArrowRight');
// Lower thumb moved from 20 to 21
await expect(lowerThumb).toHaveAttribute('aria-valuenow', '21');
// Upper thumb's min should have increased
const valuemin = await upperThumb.getAttribute('aria-valuemin');
expect(Number(valuemin)).toBeGreaterThanOrEqual(21);
});
test('moving upper thumb updates lower thumb aria-valuemax', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await upperThumb.click();
await page.keyboard.press('ArrowLeft');
// Upper thumb moved from 80 to 79
await expect(upperThumb).toHaveAttribute('aria-valuenow', '79');
// Lower thumb's max should have decreased
const valuemax = await lowerThumb.getAttribute('aria-valuemax');
expect(Number(valuemax)).toBeLessThanOrEqual(79);
});
});
// ------------------------------------------
// 🔴 High Priority: Keyboard Interaction
// ------------------------------------------
test.describe('APG: Keyboard Interaction', () => {
test('ArrowRight increases lower thumb value by step', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
await lowerThumb.click();
await expect(lowerThumb).toBeFocused();
const initialValue = await lowerThumb.getAttribute('aria-valuenow');
await page.keyboard.press('ArrowRight');
const newValue = await lowerThumb.getAttribute('aria-valuenow');
expect(Number(newValue)).toBe(Number(initialValue) + 1);
});
test('ArrowLeft decreases upper thumb value by step', async ({ page }) => {
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await upperThumb.click();
const initialValue = await upperThumb.getAttribute('aria-valuenow');
await page.keyboard.press('ArrowLeft');
const newValue = await upperThumb.getAttribute('aria-valuenow');
expect(Number(newValue)).toBe(Number(initialValue) - 1);
});
test('Home sets lower thumb to absolute minimum', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
await lowerThumb.click();
await page.keyboard.press('Home');
await expect(lowerThumb).toHaveAttribute('aria-valuenow', '0');
});
test('End sets lower thumb to dynamic maximum (not absolute)', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await lowerThumb.click();
// Get upper thumb value to determine expected max
const upperValue = await upperThumb.getAttribute('aria-valuenow');
await page.keyboard.press('End');
// Lower thumb should be at or near upper thumb value (respecting minDistance)
const newValue = await lowerThumb.getAttribute('aria-valuenow');
expect(Number(newValue)).toBeLessThanOrEqual(Number(upperValue));
});
test('Home sets upper thumb to dynamic minimum (not absolute)', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await upperThumb.click();
// Get lower thumb value to determine expected min
const lowerValue = await lowerThumb.getAttribute('aria-valuenow');
await page.keyboard.press('Home');
// Upper thumb should be at or near lower thumb value (respecting minDistance)
const newValue = await upperThumb.getAttribute('aria-valuenow');
expect(Number(newValue)).toBeGreaterThanOrEqual(Number(lowerValue));
});
test('End sets upper thumb to absolute maximum', async ({ page }) => {
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await upperThumb.click();
await page.keyboard.press('End');
await expect(upperThumb).toHaveAttribute('aria-valuenow', '100');
});
test('PageUp increases value by large step', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
await lowerThumb.click();
const initialValue = await lowerThumb.getAttribute('aria-valuenow');
await page.keyboard.press('PageUp');
const newValue = await lowerThumb.getAttribute('aria-valuenow');
expect(Number(newValue)).toBe(Number(initialValue) + 10);
});
test('PageDown decreases value by large step', async ({ page }) => {
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await upperThumb.click();
const initialValue = await upperThumb.getAttribute('aria-valuenow');
await page.keyboard.press('PageDown');
const newValue = await upperThumb.getAttribute('aria-valuenow');
expect(Number(newValue)).toBe(Number(initialValue) - 10);
});
});
// ------------------------------------------
// 🔴 High Priority: Collision Prevention
// ------------------------------------------
test.describe('APG: Collision Prevention', () => {
test('lower thumb cannot exceed upper thumb', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await lowerThumb.click();
// Get upper thumb's current value
const upperValue = await upperThumb.getAttribute('aria-valuenow');
// Try to move lower thumb to End (dynamic max)
await page.keyboard.press('End');
// Verify lower thumb is at or below upper thumb
const lowerValue = await lowerThumb.getAttribute('aria-valuenow');
expect(Number(lowerValue)).toBeLessThanOrEqual(Number(upperValue));
});
test('upper thumb cannot go below lower thumb', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await upperThumb.click();
// Get lower thumb's current value
const lowerValue = await lowerThumb.getAttribute('aria-valuenow');
// Try to move upper thumb to Home (dynamic min)
await page.keyboard.press('Home');
// Verify upper thumb is at or above lower thumb
const upperValue = await upperThumb.getAttribute('aria-valuenow');
expect(Number(upperValue)).toBeGreaterThanOrEqual(Number(lowerValue));
});
test('thumbs cannot cross when rapidly pressing arrow keys', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
// Move lower thumb toward upper thumb
await lowerThumb.click();
for (let i = 0; i < 100; i++) {
await page.keyboard.press('ArrowRight');
}
const lowerValue = await lowerThumb.getAttribute('aria-valuenow');
const upperValue = await upperThumb.getAttribute('aria-valuenow');
expect(Number(lowerValue)).toBeLessThanOrEqual(Number(upperValue));
});
});
// ------------------------------------------
// 🔴 High Priority: Focus Management
// ------------------------------------------
test.describe('APG: Focus Management', () => {
test('Tab moves from lower to upper thumb', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await lowerThumb.focus();
await expect(lowerThumb).toBeFocused();
await page.keyboard.press('Tab');
await expect(upperThumb).toBeFocused();
});
test('Shift+Tab moves from upper to lower thumb', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await upperThumb.focus();
await expect(upperThumb).toBeFocused();
await page.keyboard.press('Shift+Tab');
await expect(lowerThumb).toBeFocused();
});
test('both thumbs have tabindex="0"', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await expect(lowerThumb).toHaveAttribute('tabindex', '0');
await expect(upperThumb).toHaveAttribute('tabindex', '0');
});
});
// ------------------------------------------
// 🟡 Medium Priority: aria-valuetext Updates
// ------------------------------------------
test.describe('aria-valuetext Updates', () => {
test('lower thumb aria-valuetext updates on value change', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
await lowerThumb.click();
await page.keyboard.press('Home');
await expect(lowerThumb).toHaveAttribute('aria-valuetext', '$0');
await page.keyboard.press('ArrowRight');
await expect(lowerThumb).toHaveAttribute('aria-valuetext', '$1');
});
test('upper thumb aria-valuetext updates on value change', async ({ page }) => {
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await upperThumb.click();
await page.keyboard.press('End');
await expect(upperThumb).toHaveAttribute('aria-valuetext', '$100');
await page.keyboard.press('ArrowLeft');
await expect(upperThumb).toHaveAttribute('aria-valuetext', '$99');
});
});
// ------------------------------------------
// 🟢 Low Priority: Accessibility
// ------------------------------------------
test.describe('Accessibility', () => {
test('has no axe-core violations', async ({ page }) => {
const results = await new AxeBuilder({ page })
.include('[data-testid="basic-slider"]')
.exclude('[aria-hidden="true"]')
.analyze();
expect(results.violations).toEqual([]);
});
test('both sliders pass axe-core', async ({ page }) => {
const results = await new AxeBuilder({ page })
.include('[data-testid="basic-slider"] [role="slider"]')
.analyze();
expect(results.violations).toEqual([]);
});
});
// ------------------------------------------
// 🟡 Medium Priority: Pointer Interactions
// ------------------------------------------
test.describe('Pointer Interactions', () => {
test('track click moves nearest thumb', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const track = page.locator('[data-testid="basic-slider"] .apg-slider-multithumb-track');
// Click near the start of the track (should move lower thumb)
const trackBox = await track.boundingBox();
if (trackBox) {
await page.mouse.click(trackBox.x + 10, trackBox.y + trackBox.height / 2);
}
// Lower thumb should have moved toward the click position
const newValue = await lowerThumb.getAttribute('aria-valuenow');
expect(Number(newValue)).toBeLessThan(20); // Was 20, should be lower
});
test('thumb can be dragged', async ({ page }) => {
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const thumbBox = await lowerThumb.boundingBox();
if (thumbBox) {
// Drag thumb to the right
await page.mouse.move(thumbBox.x + thumbBox.width / 2, thumbBox.y + thumbBox.height / 2);
await page.mouse.down();
await page.mouse.move(thumbBox.x + 100, thumbBox.y + thumbBox.height / 2);
await page.mouse.up();
}
// Value should have increased
const newValue = await lowerThumb.getAttribute('aria-valuenow');
expect(Number(newValue)).toBeGreaterThan(20); // Was 20
});
});
// ------------------------------------------
// 🟡 Medium Priority: Disabled State
// ------------------------------------------
test.describe('Disabled State', () => {
test('disabled slider thumbs have tabindex="-1"', async ({ page }) => {
const disabledSliders = page.locator('[data-testid="disabled-slider"]').getByRole('slider');
await expect(disabledSliders.first()).toHaveAttribute('tabindex', '-1');
await expect(disabledSliders.last()).toHaveAttribute('tabindex', '-1');
});
test('disabled slider thumbs have aria-disabled="true"', async ({ page }) => {
const disabledSliders = page.locator('[data-testid="disabled-slider"]').getByRole('slider');
await expect(disabledSliders.first()).toHaveAttribute('aria-disabled', 'true');
await expect(disabledSliders.last()).toHaveAttribute('aria-disabled', 'true');
});
test('disabled slider ignores keyboard input', async ({ page }) => {
const disabledThumb = page
.locator('[data-testid="disabled-slider"]')
.getByRole('slider')
.first();
const initialValue = await disabledThumb.getAttribute('aria-valuenow');
// Try to click and press arrow key (disabled elements can still receive focus via click)
await disabledThumb.click({ force: true });
await page.keyboard.press('ArrowRight');
// Value should not change
await expect(disabledThumb).toHaveAttribute('aria-valuenow', initialValue!);
});
});
// ------------------------------------------
// 🟡 Medium Priority: Vertical Orientation
// ------------------------------------------
test.describe('Vertical Orientation', () => {
test('vertical slider has aria-orientation="vertical"', async ({ page }) => {
const verticalSliders = page.locator('[data-testid="vertical-slider"]').getByRole('slider');
await expect(verticalSliders.first()).toHaveAttribute('aria-orientation', 'vertical');
await expect(verticalSliders.last()).toHaveAttribute('aria-orientation', 'vertical');
});
test('vertical slider responds to ArrowUp/Down', async ({ page }) => {
const verticalThumb = page
.locator('[data-testid="vertical-slider"]')
.getByRole('slider')
.first();
await verticalThumb.click();
const initialValue = await verticalThumb.getAttribute('aria-valuenow');
await page.keyboard.press('ArrowUp');
const afterUp = await verticalThumb.getAttribute('aria-valuenow');
expect(Number(afterUp)).toBe(Number(initialValue) + 1);
await page.keyboard.press('ArrowDown');
const afterDown = await verticalThumb.getAttribute('aria-valuenow');
expect(Number(afterDown)).toBe(Number(initialValue));
});
});
// ------------------------------------------
// 🟡 Medium Priority: minDistance
// ------------------------------------------
test.describe('minDistance Constraint', () => {
test('thumbs maintain minimum distance', async ({ page }) => {
const minDistanceSliders = page
.locator('[data-testid="min-distance-slider"]')
.getByRole('slider');
const lowerThumb = minDistanceSliders.first();
const upperThumb = minDistanceSliders.last();
// Try to move lower thumb to End
await lowerThumb.click();
await page.keyboard.press('End');
const lowerValue = Number(await lowerThumb.getAttribute('aria-valuenow'));
const upperValue = Number(await upperThumb.getAttribute('aria-valuenow'));
// Should maintain minDistance of 10
expect(upperValue - lowerValue).toBeGreaterThanOrEqual(10);
});
test('lower thumb aria-valuemax respects minDistance', async ({ page }) => {
const minDistanceSliders = page
.locator('[data-testid="min-distance-slider"]')
.getByRole('slider');
const lowerThumb = minDistanceSliders.first();
const upperThumb = minDistanceSliders.last();
const upperValue = Number(await upperThumb.getAttribute('aria-valuenow'));
const lowerMax = Number(await lowerThumb.getAttribute('aria-valuemax'));
// Lower thumb max should be upper value - minDistance
expect(lowerMax).toBeLessThanOrEqual(upperValue - 10);
});
test('upper thumb aria-valuemin respects minDistance', async ({ page }) => {
const minDistanceSliders = page
.locator('[data-testid="min-distance-slider"]')
.getByRole('slider');
const lowerThumb = minDistanceSliders.first();
const upperThumb = minDistanceSliders.last();
const lowerValue = Number(await lowerThumb.getAttribute('aria-valuenow'));
const upperMin = Number(await upperThumb.getAttribute('aria-valuemin'));
// Upper thumb min should be lower value + minDistance
expect(upperMin).toBeGreaterThanOrEqual(lowerValue + 10);
});
});
});
}
// ============================================
// Cross-framework Consistency Tests
// ============================================
test.describe('MultiThumbSlider - Cross-framework Consistency', () => {
test('all frameworks render two sliders', async ({ page }) => {
for (const framework of frameworks) {
await page.goto(`patterns/slider-multithumb/${framework}/demo/`);
await getSliders(page).first().waitFor();
const sliders = getSliders(page);
const count = await sliders.count();
expect(count).toBe(2);
}
});
test('all frameworks have consistent initial values', async ({ page }) => {
test.setTimeout(60000);
for (const framework of frameworks) {
await page.goto(`patterns/slider-multithumb/${framework}/demo/`);
await getSliders(page).first().waitFor();
// Wait for hydration
await expect
.poll(async () => {
const valuenow = await getSliders(page).first().getAttribute('aria-valuenow');
return valuenow !== null;
})
.toBe(true);
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
await expect(lowerThumb).toHaveAttribute('aria-valuenow', '20');
await expect(upperThumb).toHaveAttribute('aria-valuenow', '80');
}
});
test('all frameworks support keyboard navigation', async ({ page }) => {
test.setTimeout(60000);
for (const framework of frameworks) {
await page.goto(`patterns/slider-multithumb/${framework}/demo/`);
await getSliders(page).first().waitFor();
// Wait for hydration
await expect
.poll(async () => {
const valuenow = await getSliders(page).first().getAttribute('aria-valuenow');
return valuenow !== null;
})
.toBe(true);
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
await lowerThumb.click();
// Test ArrowRight
const initialValue = await lowerThumb.getAttribute('aria-valuenow');
await page.keyboard.press('ArrowRight');
const newValue = await lowerThumb.getAttribute('aria-valuenow');
expect(Number(newValue)).toBe(Number(initialValue) + 1);
}
});
test('all frameworks prevent thumb crossing', async ({ page }) => {
test.setTimeout(60000);
for (const framework of frameworks) {
await page.goto(`patterns/slider-multithumb/${framework}/demo/`);
await getSliders(page).first().waitFor();
// Wait for hydration
await expect
.poll(async () => {
const valuenow = await getSliders(page).first().getAttribute('aria-valuenow');
return valuenow !== null;
})
.toBe(true);
const lowerThumb = getSliderByLabel(page, 'Minimum Price');
const upperThumb = getSliderByLabel(page, 'Maximum Price');
// Try to move lower thumb beyond upper
await lowerThumb.click();
await page.keyboard.press('End');
const lowerValue = Number(await lowerThumb.getAttribute('aria-valuenow'));
const upperValue = Number(await upperThumb.getAttribute('aria-valuenow'));
expect(lowerValue).toBeLessThanOrEqual(upperValue);
}
});
}); テストの実行
# Run unit tests for MultiThumbSlider
npm run test -- MultiThumbSlider
# Run E2E tests for MultiThumbSlider (all frameworks)
npm run test:e2e:pattern --pattern=slider-multithumb
# Run E2E tests for specific framework
npm run test:e2e:react:pattern --pattern=slider-multithumb
npm run test:e2e:vue:pattern --pattern=slider-multithumb
npm run test:e2e:svelte:pattern --pattern=slider-multithumb
npm run test:e2e:astro:pattern --pattern=slider-multithumb テストツール
- Vitest (opens in new tab) - ユニットテストランナー
- Testing Library (opens in new tab) - フレームワーク別テストユーティリティ
- Playwright (opens in new tab) - E2Eテスト用ブラウザ自動化
- axe-core (opens in new tab) - アクセシビリティテストエンジン
リソース
- WAI-ARIA APG: Slider (Multi-Thumb) パターン (opens in new tab)
- WAI-ARIA APG: Slider パターン (opens in new tab)
- MDN: Web Components (opens in new tab)
- AI Implementation Guide (llm.md) (opens in new tab) - ARIA specs, keyboard support, test checklist