Skip to content

🎨 Palette: Improve form submission UX and Navbar accessibility#32

Open
BilalkhanIO wants to merge 1 commit intomainfrom
palette/improve-login-ux-7062473540464968753
Open

🎨 Palette: Improve form submission UX and Navbar accessibility#32
BilalkhanIO wants to merge 1 commit intomainfrom
palette/improve-login-ux-7062473540464968753

Conversation

@BilalkhanIO
Copy link
Owner

@BilalkhanIO BilalkhanIO commented Feb 1, 2026

This PR introduces a few micro-UX and accessibility improvements:

  1. Login Submission Feedback: Added an isLoading state to the Login form. When submitting, the button now shows "Logging in..." and is disabled, providing immediate feedback and preventing double-clicks.
  2. Visual Polishing: Added :disabled styles (lower opacity and 'not-allowed' cursor) to the common .form__btn class in both Login and Signup stylesheets.
  3. Navbar Accessibility: Added an aria-label to the shopping cart icon in the Navbar, along with aria-hidden on its children, to ensure screen reader users understand the link's purpose and the current item count.

These changes ensure a more consistent and accessible experience across the application's core flows.


PR created automatically by Jules for task 7062473540464968753 started by @BilalkhanIO

Summary by CodeRabbit

  • New Features

    • Login form now provides visual loading feedback with a disabled submit button and "Logging in..." message during authentication
    • Shopping cart accessibility enhanced with descriptive ARIA labels
  • Style

    • Added visual disabled state styling to form submit buttons across Login and Signup components
  • Documentation

    • Added best practices guide for implementing consistent form loading feedback

✏️ Tip: You can customize this high-level summary in your review settings.

- Add isLoading state to Login component
- Add :disabled styles for form buttons
- Add aria-label to Navbar cart icon
- Initialize .Jules/palette.md with UX learnings

Co-authored-by: BilalkhanIO <48455259+BilalkhanIO@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 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.

@coderabbitai
Copy link

coderabbitai bot commented Feb 1, 2026

📝 Walkthrough

Walkthrough

These changes implement consistent loading feedback for form submissions across Login and Signup components by introducing isLoading state management, adding disabled button styles, improving Navbar accessibility with ARIA attributes, and documenting the design pattern in a palette note.

Changes

Cohort / File(s) Summary
Form Loading State
fy-project/src/components/Login/Login.jsx
Introduces isLoading state to track form submission. On submit, disables the button, simulates a 2-second network request, then resets state. Button displays "Logging in..." during loading and "Login" otherwise.
Form Button Disabled Styles
fy-project/src/components/Login/Login.css, fy-project/src/components/Signup/signup.css
Adds .form__btn:disabled selector with opacity 0.7 and cursor: not-allowed to visually indicate disabled button state during form submission.
Accessibility Improvements
fy-project/src/components/Navbar/Navbar.jsx
Adds aria-label to cart anchor with item count and marks cart icon and count as aria-hidden to improve screen reader experience.
Documentation
.Jules/palette.md
Adds design note documenting the importance of consistent loading feedback in forms to prevent user confusion and multiple submissions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

A rabbit hops through forms with glee, ✨
Loading states now dance so free!
Buttons disabled, feedback clear—
No double-clicks need users fear!
ARIA whispers guide the way,
Accessibility saves the day! 🐰

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main changes: form submission UX improvements (loading states, disabled buttons) and Navbar accessibility enhancements (ARIA attributes).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch palette/improve-login-ux-7062473540464968753

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
fy-project/src/components/Login/Login.jsx (1)

10-28: ⚠️ Potential issue | 🟠 Major

Avoid logging credentials and clean up the timeout to prevent setState-after-unmount.

Line 27 logs the password in plaintext to console, which is a security risk. The setTimeout on lines 25-28 lacks cleanup and can fire after unmount, causing a memory leak warning in React. Additionally, add an early guard in handleSubmit to prevent rapid double submits before state updates propagate.

🛠️ Proposed fix
-import React, { useState } from "react";
+import React, { useEffect, useRef, useState } from "react";
 import { Link } from "react-router-dom";
 import Navbar from "../Navbar/Navbar";
 
 import './Login.css'
 
 function Login() {
   const [email, setEmail] = useState("");
   const [password, setPassword] = useState("");
   const [isLoading, setIsLoading] = useState(false);
+  const timeoutRef = useRef(null);
+
+  useEffect(() => {
+    return () => {
+      if (timeoutRef.current) {
+        clearTimeout(timeoutRef.current);
+      }
+    };
+  }, []);
 
   const handleEmailChange = (event) => {
     setEmail(event.target.value);
   };
 
   const handlePasswordChange = (event) => {
     setPassword(event.target.value);
   };
 
   const handleSubmit = (event) => {
     event.preventDefault();
+    if (isLoading) return;
     setIsLoading(true);
 
     // Simulate a network request
-    setTimeout(() => {
+    timeoutRef.current = setTimeout(() => {
       setIsLoading(false);
-      console.log("Logging in with email:", email, " and password:", password);
+      console.log("Login submitted");
     }, 2000);
   };
🧹 Nitpick comments (1)
fy-project/src/components/Navbar/Navbar.jsx (1)

24-26: Keep cart count and aria-label in sync via a single source.

Right now the count is duplicated in two places; if it ever becomes dynamic, it can drift. Consider deriving the label from the same count value.

♻️ Suggested refactor
 function Navbar() {
+    const cartCount = 3;
+    const cartLabel = `View shopping cart, ${cartCount} ${cartCount === 1 ? "item" : "items"}`;
     return (
         <div className='header'>
@@
-                    <a href='#addToCart' className='navbar__cart' aria-label="View shopping cart, 3 items">
+                    <a href='#addToCart' className='navbar__cart' aria-label={cartLabel}>
                         <FiShoppingBag className="navbar__cart-icon" aria-hidden="true" />
-                        <span className='navbar__cart_span' aria-hidden="true">3</span>
+                        <span className='navbar__cart_span' aria-hidden="true">{cartCount}</span>
                     </a>

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