Skip to content

🎨 Palette: [UX improvement]#167

Open
singhaditya21 wants to merge 1 commit into
mainfrom
jules/palette-async-loading-states-14527158548860280804
Open

🎨 Palette: [UX improvement]#167
singhaditya21 wants to merge 1 commit into
mainfrom
jules/palette-async-loading-states-14527158548860280804

Conversation

@singhaditya21

Copy link
Copy Markdown
Owner

💡 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-busy until 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 a try...finally block.


PR created automatically by Jules for task 14527158548860280804 started by @singhaditya21

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>
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant