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
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@
## 2024-06-26 - [Abbreviation Comprehension in ERD Nodes]
**Learning:** Users without deep database administration backgrounds may not immediately recognize domain-specific abbreviations like "PK" or "FK" rendered as minimalist badges inside dense ERD nodes.
**Action:** Always provide `title` attributes on technical acronym badges (like Primary Key / Foreign Key) to ensure clarity and improve accessibility without cluttering the space-constrained node UI.
## 2024-07-06 - Accessible Required Indicators and Disabled Button Helper Text
**Learning:** When using functional forms, adding a visual required indicator (`*`) isn't fully accessible on its own. It should be wrapped in an `aria-hidden="true"` span with a screen-reader-only text (e.g. `(ํ•„์ˆ˜)`) to ensure screen readers announce it explicitly. Furthermore, when a submit button is disabled due to invalid/empty inputs, purely disabling the button can leave users (and screen reader users) confused. Providing a visible helper text conditionally and linking it to the disabled button (and the input) using `aria-describedby` provides a much clearer, accessible explanation of why the action is disabled.
**Action:** Always pair visual required indicators with screen-reader-only labels. For dynamically disabled primary buttons, always display helper text explaining the requirement and link it to the relevant input and button using `aria-describedby`.
13 changes: 12 additions & 1 deletion frontend/src/components/modals/AddTableModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,26 @@ export function AddTableModal({
>
<h3 id="add-table-title">ํ…Œ์ด๋ธ” ์ถ”๊ฐ€</h3>
<div className="field">
<label htmlFor="new-table-name">ํ…Œ์ด๋ธ” ์ด๋ฆ„</label>
<label htmlFor="new-table-name">
ํ…Œ์ด๋ธ” ์ด๋ฆ„
<span aria-hidden="true" style={{ color: "#ef4444", marginLeft: "4px" }}>*</span>
<span className="srOnly"> (ํ•„์ˆ˜)</span>
</label>
<input
id="new-table-name"
value={newTableName}
onChange={(e) => setNewTableName(e.target.value)}
placeholder="users"
autoFocus
required
aria-describedby={!newTableName.trim() ? "add-table-disabled-hint" : undefined}
/>
</div>
{!newTableName.trim() && (
<span id="add-table-disabled-hint" className="field-hint">
ํ…Œ์ด๋ธ” ์ด๋ฆ„์„ ์ž…๋ ฅํ•ด์•ผ ์ €์žฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
</span>
)}
<div
className="row"
style={{ justifyContent: "flex-end", marginTop: 8 }}
Expand All @@ -79,6 +89,7 @@ export function AddTableModal({
<button
type="submit"
disabled={!newTableName.trim()}
aria-describedby={!newTableName.trim() ? "add-table-disabled-hint" : undefined}
style={
newTableName.trim()
? { background: "#034ea2", color: "#fff" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('modal dialog accessibility', () => {
/>,
);

const tableNameInput = screen.getByLabelText('ํ…Œ์ด๋ธ” ์ด๋ฆ„');
const tableNameInput = screen.getByLabelText(/ํ…Œ์ด๋ธ” ์ด๋ฆ„/);
const saveButton = screen.getByRole('button', { name: '์ €์žฅ' });

await waitFor(() => expect(tableNameInput).toHaveFocus());
Expand Down