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 @@ -46,3 +46,6 @@
## 2026-07-10 - Accessibility Anti-pattern: Excessive Tab Stops
**Learning:** Adding `tabIndex={0}` to static, non-interactive text badges (like `abbr` or `span`) just to expose their `title` or `aria-label` attributes to keyboard users is an accessibility anti-pattern. It creates excessive tab stops and severely degrades keyboard navigation for users who rely on tab to move through actionable elements.
**Action:** Never add `tabIndex={0}` to non-interactive elements unless they are specifically designed to be focusable for a functional reason. Use proper semantic HTML or let the screen reader read adjacent elements as part of natural navigation.
## 2026-07-11 - Add context to generic dialog buttons
**Learning:** Generic action buttons in dialogs should provide full context via aria-label to prevent ambiguous screen reader experiences.
**Action:** Always add aria-label to generic buttons like Delete or Cancel inside dialogs.
13 changes: 10 additions & 3 deletions frontend/src/components/modals/EditEdgeModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import React from "react";
import type { Edge } from "@xyflow/react";
import { useDialogAccessibility } from './useDialogAccessibility';
import { useDialogAccessibility } from "./useDialogAccessibility";

interface EditEdgeModalProps {
editingEdge: Edge | null;
Expand Down Expand Up @@ -78,12 +78,19 @@ export function EditEdgeModal({
<button
type="button"
onClick={onRelDelete}
aria-label={`${editingEdge.source}์—์„œ ${editingEdge.target}๋กœ์˜ ๊ด€๊ณ„ ์‚ญ์ œ`}
style={{ color: "#b91c1c", borderColor: "#fca5a5" }}
>
์‚ญ์ œ
</button>
<div className="row">
<button type="button" onClick={onRelCancel}>์ทจ์†Œ</button>
<button
type="button"
onClick={onRelCancel}
aria-label="๊ด€๊ณ„ ์„ค์ • ์ทจ์†Œ"
>
์ทจ์†Œ
</button>
<button
type="button"
onClick={onRelSubmit}
Expand Down
157 changes: 112 additions & 45 deletions frontend/src/components/modals/EditTableModal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React from 'react';
import React from "react";
import type { Node } from "@xyflow/react";
import type { TableNodeData } from "../../erd/convert";
import { useDialogAccessibility } from './useDialogAccessibility';
import { useDialogAccessibility } from "./useDialogAccessibility";

interface EditTableModalProps {
isOpen: boolean;
editingNode: Node<TableNodeData> | null;
setEditingNode: React.Dispatch<React.SetStateAction<Node<TableNodeData> | null>>;
setEditingNode: React.Dispatch<
React.SetStateAction<Node<TableNodeData> | null>
>;
setNodes: React.Dispatch<React.SetStateAction<Node<TableNodeData>[]>>;
onEditTableCancel: () => void;
onEditTableSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
Expand All @@ -22,19 +24,43 @@ export function EditTableModal({
onEditTableSubmit,
onDeleteTable,
}: EditTableModalProps) {
const dialogRef = useDialogAccessibility(isOpen && Boolean(editingNode), onEditTableCancel);
const dialogRef = useDialogAccessibility(
isOpen && Boolean(editingNode),
onEditTableCancel,
);

if (!isOpen || !editingNode) return null;

return (
<div className="modalOverlay">
<div className="modal" style={{ width: 800, maxWidth: "90vw", maxHeight: "90vh", display: "flex", flexDirection: "column" }} role="dialog" aria-modal="true" aria-labelledby="edit-table-title" ref={dialogRef} tabIndex={-1}>
<div
className="modal"
style={{
width: 800,
maxWidth: "90vw",
maxHeight: "90vh",
display: "flex",
flexDirection: "column",
}}
role="dialog"
aria-modal="true"
aria-labelledby="edit-table-title"
ref={dialogRef}
tabIndex={-1}
>
<div className="modal__header">
<h3 id="edit-table-title">ํ…Œ์ด๋ธ” ํŽธ์ง‘</h3>
<button type="button" aria-label="๋‹ซ๊ธฐ" onClick={onEditTableCancel}>X</button>
<button type="button" aria-label="๋‹ซ๊ธฐ" onClick={onEditTableCancel}>
X
</button>
</div>
<div style={{ overflowY: "auto", padding: "0 4px", flex: 1 }}>
<form id="editTableForm" onSubmit={onEditTableSubmit} className="col" style={{ gap: 12 }}>
<form
id="editTableForm"
onSubmit={onEditTableSubmit}
className="col"
style={{ gap: 12 }}
>
<div className="col">
<label htmlFor="editTableTitle">ํ…Œ์ด๋ธ”๋ช… (schema.table)</label>
<input
Expand All @@ -56,7 +82,14 @@ export function EditTableModal({
</div>

<div className="col" style={{ marginTop: 16 }}>
<div className="row" style={{ justifyContent: "space-between", alignItems: "center", marginBottom: 8 }}>
<div
className="row"
style={{
justifyContent: "space-between",
alignItems: "center",
marginBottom: 8,
}}
>
<h4 style={{ margin: 0 }}>์ปฌ๋Ÿผ</h4>
<button
type="button"
Expand All @@ -75,31 +108,31 @@ export function EditTableModal({
data_type: "text",
is_not_null: false,
is_pk: false,
}
]
}
},
],
},
};
}
return n;
})
}),
);
setEditingNode((prev: Node<TableNodeData> | null) => {
if (!prev) return prev;
return {
...prev,
data: {
...prev.data,
columns: [
...prev.data.columns,
{
column_name: `new_col_${Date.now()}`,
data_type: "text",
is_not_null: false,
is_pk: false,
}
]
}
}
if (!prev) return prev;
return {
...prev,
data: {
...prev.data,
columns: [
...prev.data.columns,
{
column_name: `new_col_${Date.now()}`,
data_type: "text",
is_not_null: false,
is_pk: false,
},
],
},
};
});
}}
>
Expand All @@ -109,7 +142,11 @@ export function EditTableModal({

<div className="col" style={{ gap: 8 }}>
{editingNode.data.columns.map((col, idx) => (
<div key={`${col.column_name}-${idx}`} className="row" style={{ gap: 8, alignItems: "center" }}>
<div
key={`${col.column_name}-${idx}`}
className="row"
style={{ gap: 8, alignItems: "center" }}
>
<input
type="text"
name={`col_name_${idx}`}
Expand All @@ -126,15 +163,21 @@ export function EditTableModal({
style={{ flex: 1.5 }}
aria-label="๋ฐ์ดํ„ฐ ํƒ€์ž…"
/>
<label className="row" style={{ gap: 4, whiteSpace: "nowrap" }}>
<label
className="row"
style={{ gap: 4, whiteSpace: "nowrap" }}
>
<input
type="checkbox"
name={`col_pk_${idx}`}
defaultChecked={col.is_pk}
/>
PK
</label>
<label className="row" style={{ gap: 4, whiteSpace: "nowrap" }}>
<label
className="row"
style={{ gap: 4, whiteSpace: "nowrap" }}
>
<input
type="checkbox"
name={`col_nn_${idx}`}
Expand All @@ -145,30 +188,39 @@ export function EditTableModal({
<button
type="button"
onClick={() => {
if (!window.confirm(`'${col.column_name}' ์ปฌ๋Ÿผ์„ ์‚ญ์ œํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?`)) return;
if (
!window.confirm(
`'${col.column_name}' ์ปฌ๋Ÿผ์„ ์‚ญ์ œํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?`,
)
)
return;
setNodes((nds: Node<TableNodeData>[]) =>
nds.map((n: Node<TableNodeData>) => {
if (n.id === editingNode.id) {
return {
...n,
data: {
...n.data,
columns: n.data.columns.filter((_, i) => i !== idx)
}
columns: n.data.columns.filter(
(_, i) => i !== idx,
),
},
};
}
return n;
})
}),
);
setEditingNode((prev: Node<TableNodeData> | null) => {
if (!prev) return prev;
return {
...prev,
data: {
...prev.data,
columns: prev.data.columns.filter((_, i) => i !== idx)
}
};
if (!prev) return prev;
return {
...prev,
data: {
...prev.data,
columns: prev.data.columns.filter(
(_, i) => i !== idx,
),
},
};
});
}}
style={{ color: "#b91c1c", padding: "4px 8px" }}
Expand All @@ -183,11 +235,20 @@ export function EditTableModal({
</form>
</div>

<div className="row" style={{ justifyContent: "space-between", marginTop: 16, paddingTop: 16, borderTop: "1px solid #e2e8f0" }}>
<div
className="row"
style={{
justifyContent: "space-between",
marginTop: 16,
paddingTop: 16,
borderTop: "1px solid #e2e8f0",
}}
>
<div className="row" style={{ gap: 8 }}>
<button
type="button"
onClick={onDeleteTable}
aria-label={`${editingNode.data.title} ํ…Œ์ด๋ธ” ์‚ญ์ œ`}
style={{ color: "#b91c1c", borderColor: "#fca5a5" }}
>
ํ…Œ์ด๋ธ” ์‚ญ์ œ
Expand Down Expand Up @@ -221,7 +282,13 @@ export function EditTableModal({
</button>
</div>
<div className="row">
<button type="button" onClick={onEditTableCancel}>์ทจ์†Œ</button>
<button
type="button"
onClick={onEditTableCancel}
aria-label="ํ…Œ์ด๋ธ” ํŽธ์ง‘ ์ทจ์†Œ"
>
์ทจ์†Œ
</button>
<button
type="submit"
form="editTableForm"
Expand Down
Loading