Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@
## 2024-07-13 - [Table Node Accessibility]
**Learning:** Adding `aria-hidden="true"` inside `abbr` elements with `aria-label` prevents screen readers from redundantly announcing short abbreviations like "PK" or "NN" along with their full label.
**Action:** When creating short, domain-specific abbreviations with tooltips, use `aria-label` on the wrapper and hide the visual text from screen readers using `aria-hidden="true"` to create a cleaner auditory experience.
## 2024-05-18 - [Add aria-disabled and tooltip to disabled buttons]
**Learning:** In React, replacing the native `disabled` attribute with `aria-disabled="true"` correctly announces the disabled state to screen readers and keeps the element focusable to display tooltips on hover/focus. However, unlike native `disabled`, `aria-disabled` does not block click events or form submissions. For form submit buttons, when the native `disabled` attribute is removed, pressing "Enter" in an input field will trigger a form submission.
**Action:** When converting a button to use `aria-disabled`, you must explicitly intercept the click/submit action by adding an `onClick` handler that calls `e.preventDefault()` when the button is logically disabled (e.g., `onClick={(e) => { if (!isValid) e.preventDefault(); }}`).
10 changes: 6 additions & 4 deletions frontend/src/components/modals/AddTableModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ export function AddTableModal({
<button type="button" onClick={onAddTableCancel}>μ·¨μ†Œ</button>
<button
type="submit"
disabled={!newTableName.trim()}
aria-disabled={!newTableName.trim()}
title={!newTableName.trim() ? "ν…Œμ΄λΈ” 이름을 μž…λ ₯ν•˜μ„Έμš”" : undefined}
onClick={(e) => { if (!newTableName.trim()) e.preventDefault(); }}
style={
newTableName.trim()
? { background: "#034ea2", color: "#fff" }
: undefined
!newTableName.trim()
? { opacity: 0.5, cursor: "not-allowed" }
: { background: "#034ea2", color: "#fff" }
}
>
μ €μž₯
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/modals/GroupModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ export function GroupModal({
</div>
<button
type="submit"
disabled={!newGroupName.trim()}
aria-disabled={!newGroupName.trim()}
title={!newGroupName.trim() ? "κ·Έλ£Ή 이름을 μž…λ ₯ν•˜μ„Έμš”" : undefined}
onClick={(e) => { if (!newGroupName.trim()) e.preventDefault(); }}
style={!newGroupName.trim() ? { opacity: 0.5, cursor: "not-allowed" } : undefined}
>
μΆ”κ°€
</button>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/modals/ModalCoverage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('modal behavior coverage', () => {
)
fireEvent.submit(screen.getByRole('dialog'))
expect(onSubmit).toHaveBeenCalledOnce()
expect(screen.getByRole('button', { name: 'μ €μž₯' })).toBeEnabled()
expect(screen.getByRole('button', { name: 'μ €μž₯' })).toHaveAttribute('aria-disabled', 'false')
})

it('covers EditEdgeModal visibility and actions', () => {
Expand Down Expand Up @@ -242,7 +242,7 @@ describe('modal behavior coverage', () => {
/>,
)
expect(screen.getByText('λ“±λ‘λœ 그룹이 μ—†μŠ΅λ‹ˆλ‹€.')).toBeInTheDocument()
expect(screen.getByRole('button', { name: 'μΆ”κ°€' })).toBeDisabled()
expect(screen.getByRole('button', { name: 'μΆ”κ°€' })).toHaveAttribute('aria-disabled', 'true')

rerender(
<GroupModal
Expand Down
Loading