🎨 Palette: [UX improvement]#167
Conversation
This commit introduces async loading states to the Login, Register, and Google Sign-In buttons in `web-demo/js/app.js`. Changes made: - Passed the event object `e` explicitly in `setupEventListeners` for `handleGoogleSignIn`. - Extracted `e.submitter` or `e.currentTarget` at the start of `handleLogin`, `handleRegister`, and `handleGoogleSignIn` to safely manipulate the button that triggered the event. - Updated button UI to disable it, change the text to indicate loading (e.g., "Logging in...", "Connecting..."), and set `aria-busy="true"` for accessibility. - Refactored `setTimeout` in the Google Sign-In flow to use an awaitable Promise (`await new Promise(resolve => setTimeout(resolve, 1500))`) so the UI doesn't restore prematurely. - Wrapped API calls in `try...finally` blocks to guarantee UI state recovery (restoring original HTML, re-enabling the button, and removing `aria-busy`) regardless of API success or failure. - Documented these learnings in `.Jules/palette.md`. Co-authored-by: singhaditya21 <53948039+singhaditya21@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What: Added async loading states to the Login, Register, and Google Sign-In buttons in the web demo app.
🎯 Why: To provide immediate visual feedback to the user when submitting authentication forms, preventing double submissions and clarifying system status during async API calls.
📸 Before/After: (See frontend verification screenshots). Before, buttons remained active and unchanged during API calls. After, buttons disable, display "Logging in..." or similar text, and use
aria-busyuntil the process finishes.♿ Accessibility: Added
aria-busy="true"to buttons while the async operation is ongoing, informing screen readers of the background processing, and reliably restored states using atry...finallyblock.PR created automatically by Jules for task 14527158548860280804 started by @singhaditya21