Skip to content

A11y/add aria labels calculators - #934

Open
thatperplextion wants to merge 8 commits into
parthbuilds-community:mainfrom
thatperplextion:a11y/add-aria-labels-calculators
Open

A11y/add aria labels calculators#934
thatperplextion wants to merge 8 commits into
parthbuilds-community:mainfrom
thatperplextion:a11y/add-aria-labels-calculators

Conversation

@thatperplextion

Copy link
Copy Markdown

📋 What does this PR do?

A clear summary of the changes made.

🔗 Related Issue

Closes #

🧪 How was this tested?

Describe how you tested your changes (manual steps, screenshots, etc.)

📸 Screenshots (if UI changes)

Before / After screenshots if you changed any UI.

✅ Checklist

  • I've read the CONTRIBUTING guide
  • My code follows the project's style guidelines
  • I've tested my changes locally
  • I've linked the related issue
  • I haven't introduced any new secrets or API keys

Copilot AI lite review requested due to automatic review settings August 9, 2026 10:36
@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request refactor Improve code without changing functionality UI UI-related improvements including layouts, responsiveness, styling, animations, and UX enhancements. frontend labels Aug 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves client-side UX and accessibility by adding calculator input validation and ARIA attributes, while also standardizing some utilities with clearer JSDoc and replacing blocking alert() error handling with toast notifications.

Changes:

  • Added validation + ARIA attributes (including button labels) to BMI and calorie calculators.
  • Replaced alert() calls with a Toast-based notification flow on multiple pages.
  • Added/expanded JSDoc comments in several utility modules and removed exercise-page debug logging.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
client/src/components/CalorieCalculator.jsx Adds validation + error UI and ARIA attributes for improved accessibility.
client/src/components/BMICalculator.jsx Adds validation + error UI and ARIA attributes; updates calculation flow.
client/src/pages/ProductPage.jsx Replaces alert() error handling with Toast notifications.
client/src/pages/HomePage.jsx Replaces alert() error handling with Toast notifications.
client/src/pages/NotesPage.jsx Replaces empty-title alert() with Toast notification.
client/src/pages/ExercisePage.jsx Removes client-side debug logging and warning noise.
client/src/utils/rewardsUtils.js Adds JSDoc documentation to existing rewards utilities.
client/src/utils/normalizeProduct.js Adds JSDoc documentation to product normalization helper.
client/src/utils/getAuthHeaders.js Adds JSDoc documentation to auth header helper.
client/src/utils/formatters.js Adds JSDoc documentation to the INR currency formatter.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +38 to +50
// Validation with reasonable bounds
if (!w || w < 20 || w > 300) {
setError("Please enter a valid weight between 20kg and 300kg.");
return;
}
if (!h || h < 50 || h > 250) {
setError("Please enter a valid height between 50cm and 250cm.");
return;
}
if (!a || a < 10 || a > 100) {
setError("Please enter a valid age between 10 and 100 years.");
return;
}
>
<form onSubmit={handleCalculate} className="space-y-6 sm:space-y-8">
{error && (
<div className="bg-red-50 border border-red-100 text-red-600 px-4 py-3 rounded-lg text-sm">
>
<form onSubmit={handleCalculate} className="space-y-6 sm:space-y-8">
{error && (
<div className="bg-red-50 border border-red-100 text-red-600 px-4 py-3 rounded-lg text-sm">
const navigate = useNavigate();

const [product, setProduct] = useState(null);
const [toast, setToast] = useState({ message: '', type: 'success', visible: false });
Comment on lines +147 to +148
setToast({ message: err.message || 'Failed to add to cart', type: 'error', visible: true });
setTimeout(() => setToast(prev => ({ ...prev, visible: false })), 3000);
Comment on lines +283 to +284
setToast({ message: err.message || 'Failed to add to cart', type: 'error', visible: true });
setTimeout(() => setToast(prev => ({ ...prev, visible: false })), 3000);
* Returns authentication headers for API requests.
* In development mode, prefers a local dev token if present.
* Otherwise, uses Firebase authentication token if user is logged in.
* @returns {Promise<{Content-Type: string, Authorization?: string}>} Headers object with optional Bearer token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request frontend refactor Improve code without changing functionality UI UI-related improvements including layouts, responsiveness, styling, animations, and UX enhancements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants