Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
## 2024-11-20 - CopyPromptButton ์ ‘๊ทผ์„ฑ ํ–ฅ์ƒ (๋™์  ํ…์ŠคํŠธ ๋ฐ ์ƒํƒœ)
**Learning:** `CopyPromptButton`๊ณผ ๊ฐ™์ด ๋ฒ„ํŠผ์„ ํด๋ฆญํ–ˆ์„ ๋•Œ ์‹œ๊ฐ์ ์œผ๋กœ๋งŒ ์ƒํƒœ๊ฐ€ ๋ณ€ํ•˜๊ณ (์˜ˆ: ๋ณต์‚ฌ ์•„์ด์ฝ˜์ด ์ฒดํฌ ์•„์ด์ฝ˜์œผ๋กœ ๋ณ€๊ฒฝ), ํ…์ŠคํŠธ๊ฐ€ ๋™์ ์œผ๋กœ ๋ณ€๊ฒฝ๋˜๋Š” ์ปดํฌ๋„ŒํŠธ์—์„œ๋Š” ์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์‚ฌ์šฉ์ž๊ฐ€ ์ƒํƒœ ๋ณ€ํ™”๋ฅผ ์•Œ์•„์ฑ„๊ธฐ ์–ด๋ ต์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ ์Šคํฌ๋ฆฐ ๋ฆฌ๋”๊ฐ€ ์ˆœ์ˆ˜ ์žฅ์‹์šฉ ์•„์ด์ฝ˜๊นŒ์ง€ ๋ถˆํ•„์š”ํ•˜๊ฒŒ ์ฝ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
**Action:** ๋™์ ์œผ๋กœ ๋ณ€๊ฒฝ๋˜๋Š” ํ…์ŠคํŠธ๋ฅผ `<span aria-live="polite">`๋กœ ๊ฐ์‹ธ ์Šคํฌ๋ฆฐ ๋ฆฌ๋”๊ฐ€ ์ฆ‰์‹œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์ฝ์–ด์ฃผ๋„๋ก ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. `<Button>` ์ปดํฌ๋„ŒํŠธ์—๋Š” `aria-pressed={copied}`๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ํ† ๊ธ€ ์„ฑ๊ฒฉ์„ ๋ถ€์—ฌํ•˜๊ณ , ์‹œ๊ฐ์ ์ธ ์•„์ด์ฝ˜ ์ปดํฌ๋„ŒํŠธ(์˜ˆ: `<Copy>`, `<Check>`)์—๋Š” `aria-hidden="true"`๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ์Šคํฌ๋ฆฐ ๋ฆฌ๋”์—์„œ ๋ฌด์‹œํ•˜๋„๋ก ์ฒ˜๋ฆฌํ•˜๋Š” ํŒจํ„ด์„ ์ง€์†์ ์œผ๋กœ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

## 2024-11-20 - CopyPromptButton ์ ‘๊ทผ์„ฑ ํ–ฅ์ƒ (์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์ƒํƒœ ๋ฐœํ‘œ ์ตœ์ ํ™”)
**Learning:** ํฌ์ปค์Šค๋œ ๋ฒ„ํŠผ์˜ ํ…์ŠคํŠธ๊ฐ€ ์‹œ๊ฐ์ ์œผ๋กœ ๋ณ€๊ฒฝ๋  ๋•Œ, `aria-live` ์†์„ฑ์„ ์ง์ ‘ ์‚ฌ์šฉํ•˜์—ฌ ์ ‘๊ทผ์„ฑ ์ด๋ฆ„์„ ๋ณ€๊ฒฝํ•˜๋ฉด ์Šคํฌ๋ฆฐ ๋ฆฌ๋”์—์„œ ์ด์ค‘์œผ๋กœ ์ฝ์–ด์ฃผ๊ฑฐ๋‚˜ ์ผ๊ด€์„ฑ ์—†๋Š” ๋™์ž‘์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
**Action:** ์‹œ๊ฐ์  ํ…์ŠคํŠธ์™€ ์Šคํฌ๋ฆฐ ๋ฆฌ๋”์šฉ ํ…์ŠคํŠธ๋ฅผ ๋ถ„๋ฆฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์‹œ๊ฐ์  ํ…์ŠคํŠธ๋Š” `aria-hidden="true"`๋กœ ์ˆจ๊ธฐ๊ณ , ์Šคํฌ๋ฆฐ ๋ฆฌ๋”์šฉ ์•ˆ๋‚ด ํ…์ŠคํŠธ๋Š” ๋ณ„๋„์˜ ํ˜•์ œ ์š”์†Œ๋กœ `role="status"` ์™€ `aria-atomic="true"`๋ฅผ ๊ฐ€์ง€๋ฉฐ `sr-only` (์‹œ๊ฐ์  ์ˆจ๊น€) ํด๋ž˜์Šค๋ฅผ ์ ์šฉํ•˜์—ฌ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"undici": "^7.29.0",
"minimatch": "^10.0.0",
"@hono/node-server": "^2.0.5",
"body-parser": "^2.3.0"
"body-parser": "^2.3.0",
"deepmerge-ts": "^8.0.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๐Ÿ” Unrelated dependency override in package.json

The deepmerge-ts override added to package.json is unrelated to the accessibility change this PR describes. Worth confirming it belongs here rather than being an incidental addition.

Open in Devin Review

Was this helpful? React with ๐Ÿ‘ or ๐Ÿ‘Ž to provide feedback.

}
}
}
8 changes: 4 additions & 4 deletions packages/web/src/components/copy-prompt-button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ describe('CopyPromptButton', () => {
const button = screen.getByRole('button');
expect(button).toBeDefined();
expect(button.getAttribute('aria-pressed')).toBe('false');
expect(screen.getByText('ํ”„๋กฌํ”„ํŠธ ๋ณต์‚ฌ')).toBeDefined();
expect(screen.getAllByText('ํ”„๋กฌํ”„ํŠธ ๋ณต์‚ฌ')[0]).toBeDefined();
expect(screen.getByTestId('copy-icon')).toBeDefined();
});

it('renders correctly with custom labels', () => {
render(<CopyPromptButton text="test prompt" label="Copy" copiedLabel="Copied" />);

expect(screen.getByText('Copy')).toBeDefined();
expect(screen.getAllByText('Copy')[0]).toBeDefined();
});

it('copies text and shows copied state temporarily', async () => {
Expand All @@ -61,7 +61,7 @@ describe('CopyPromptButton', () => {

// Check copied state
expect(button.getAttribute('aria-pressed')).toBe('true');
expect(screen.getByText('Copied')).toBeDefined();
expect(screen.getAllByText('Copied')[0]).toBeDefined();
expect(screen.getByTestId('check-icon')).toBeDefined();

// Fast-forward timer
Expand All @@ -71,7 +71,7 @@ describe('CopyPromptButton', () => {

// Check reverted state
expect(button.getAttribute('aria-pressed')).toBe('false');
expect(screen.getByText('Copy')).toBeDefined();
expect(screen.getAllByText('Copy')[0]).toBeDefined();
expect(screen.getByTestId('copy-icon')).toBeDefined();
});

Expand Down
5 changes: 4 additions & 1 deletion packages/web/src/components/copy-prompt-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export function CopyPromptButton({
className={cn("gap-1.5", className)}
>
{copied ? <Check aria-hidden="true" /> : <Copy aria-hidden="true" />}
<span aria-live="polite">
<span aria-hidden="true">
{copied ? copiedLabel : label}
</span>
<span className="sr-only" role="status" aria-atomic="true">
{copied ? copiedLabel : label}
</span>
Comment on lines +47 to 49

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๐Ÿ“ Info: sr-only status span still contributes to accessible name

The sr-only span (copy-prompt-button.tsx:47-49) carries role="status" and is also the only text feeding the button's accessible name. Because the same element both names the button and acts as a live region, toggling copied can still cause the double announcement this change intends to remove, depending on the screen reader.

Open in Devin Review

Was this helpful? React with ๐Ÿ‘ or ๐Ÿ‘Ž to provide feedback.

</Button>
Expand Down
11 changes: 6 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading