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
4 changes: 4 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@
## 2024-07-14 - Native Keyboard Submission with Forms for Modals
**Learning:** Modals designed with plain `<div>` elements as wrappers instead of `<form>` lack native keyboard submission support, forcing users to switch from keyboard to mouse to confirm actions like "Save".
**Action:** When designing modals or popups containing inputs, always use a `<form>` element to wrap the content, handle the `onSubmit` event (calling `e.preventDefault()`), and set the primary confirmation button to `type="submit"` to enable seamless Enter-key submission for keyboard users.

## $(date +%Y-%m-%d) - Native Keyboard Submission Support
**Learning:** React elements with input fields and an adjacent save/create button (often structured using `div`) prevent users from pressing "Enter" natively to submit.
**Action:** Replaced semantic container `div` wrappers with `<form onSubmit={...}>` and updated `button type="button"` to `button type="submit"`. Always prefer form wrapping for groups containing inputs and an explicit action button to inherently support standard UX accessibility patterns like keyboard submission.
45 changes: 33 additions & 12 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1075,15 +1075,22 @@ export default function App() {

<div className="field">
<label htmlFor="project-name">New project</label>
<div className="row">
<form
className="row"
onSubmit={(e) => {
e.preventDefault();
if (projectName.trim() && !isCreatingProject) {
Comment on lines +1078 to +1082
onCreateProject();
}
}}
Comment on lines +1080 to +1085
>
<input
id="project-name"
value={projectName}
onChange={(e) => setProjectName(e.target.value)}
/>
<button
type="button"
onClick={onCreateProject}
type="submit"
disabled={!projectName.trim() || isCreatingProject}
aria-busy={isCreatingProject}
aria-describedby={
Expand All @@ -1092,7 +1099,7 @@ export default function App() {
>
{isCreatingProject ? "Creatingโ€ฆ" : "Create"}
</button>
</div>
</form>
{createProjectHint ? (
<span id="create-project-hint" className="field-hint">
{createProjectHint}
Expand Down Expand Up @@ -1121,7 +1128,15 @@ export default function App() {
</select>
</div>

<div className="field">
<form
className="field"
onSubmit={(e) => {
e.preventDefault();
if (selectedProjectId && connName.trim() && isDsnPresent && !isCreatingConnection) {
onCreateConnection();
}
}}
Comment on lines +1133 to +1138
>
<label htmlFor="conn-name">New connection (DSN)</label>
<input
id="conn-name"
Expand All @@ -1140,8 +1155,7 @@ export default function App() {
aria-label="Connection DSN"
/>
<button
type="button"
onClick={onCreateConnection}
type="submit"
disabled={
!selectedProjectId ||
!connName.trim() ||
Expand All @@ -1160,7 +1174,7 @@ export default function App() {
{createConnectionHint}
</span>
) : null}
</div>
</form>

<div className="field">
<label htmlFor="schema-filter">Schema filter (optional)</label>
Expand Down Expand Up @@ -1304,20 +1318,27 @@ export default function App() {
<h1 id="projects-title">ํ”„๋กœ์ ํŠธ</h1>
<p>ํ”„๋กœ์ ํŠธ๋ฅผ ์„ ํƒํ•˜๋ฉด ํ•ด๋‹น ๋‹ค์ด์–ด๊ทธ๋žจ ๋ชฉ๋ก์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.</p>
</div>
<div className="inlineCreate">
<form
className="inlineCreate"
onSubmit={(e) => {
e.preventDefault();
if (projectName.trim() && !isCreatingProject) {
onCreateProject();
}
}}
>
<input
aria-label="์ƒˆ ํ”„๋กœ์ ํŠธ ์ด๋ฆ„"
value={projectName}
onChange={(event) => setProjectName(event.currentTarget.value)}
/>
<button
type="button"
onClick={onCreateProject}
type="submit"
disabled={!projectName.trim() || isCreatingProject}
>
{isCreatingProject ? "์ƒ์„ฑ ์ค‘" : "์ƒˆ ํ”„๋กœ์ ํŠธ"}
</button>
</div>
</form>
</div>
<div className="dataTable" role="table" aria-label="ํ”„๋กœ์ ํŠธ ๋ชฉ๋ก">
<div className="dataTable__row dataTable__row--projects dataTable__row--head" role="row">
Expand Down
Loading