fix(design-system): 표 스크롤 영역에 표 제목으로 이름을 붙인다 (UI-08)

표를 감싼 스크롤 영역이 키보드 포커스(tabIndex 0)를 받지만 역할과
이름이 없었다. 스크린 리더가 이름 없는 정지점으로 읽었다.

영역에 role="region"을 주고 caption을 aria-labelledby로 연결했다.

위험: 없음. 시각 변화가 없다.
검증: 이름 있는 region을 요구하는 컴포넌트 테스트가 고치기 전 실패했고,
고친 뒤 통과했다(design-system-platform.test.tsx 10/10).
This commit is contained in:
DongHyeonka
2026-11-01 18:34:28 +09:00
parent 9363fa84e3
commit 5008013db2
2 changed files with 14 additions and 2 deletions
@@ -27,11 +27,17 @@ export function DataTable<Row>({
rowKey(row: Row): string;
empty: React.ReactNode;
}>) {
const captionId = useId();
if (rows.length === 0) return <>{empty}</>;
return (
<div className="ui-data-table__scroll" tabIndex={0}>
<div
aria-labelledby={captionId}
className="ui-data-table__scroll"
role="region"
tabIndex={0}
>
<table className="ui-data-table">
<caption>{caption}</caption>
<caption id={captionId}>{caption}</caption>
<thead>
<tr>
{columns.map((column) => (
@@ -326,6 +326,12 @@ describe("design-system platform interactions", () => {
expect(screen.getByRole("table", { name: "결과" })).toHaveTextContent(
"첫 항목",
);
// UI-08: the keyboard-scrollable wrapper is a named region, not an
// anonymous focus stop.
expect(screen.getByRole("region", { name: "결과" })).toHaveAttribute(
"tabindex",
"0",
);
await user.click(screen.getByRole("link", { name: "2페이지" }));
expect(onPage).toHaveBeenCalledWith(2);
});