Skip to content

Feature/price filter validation#133

Merged
greatest0fallt1me merged 5 commits into
CalloraOrg:mainfrom
AugistineCreates:feature/price-filter-validation
Jun 3, 2026
Merged

Feature/price filter validation#133
greatest0fallt1me merged 5 commits into
CalloraOrg:mainfrom
AugistineCreates:feature/price-filter-validation

Conversation

@AugistineCreates
Copy link
Copy Markdown

This pr closes #101

Implements highly accessible validation, bounds checking, negative clamping, and inverted-range handling for the price range filter in FiltersSidebar on the API Marketplace page. This ensures users receive immediate visual and structural feedback when inputting an invalid range, and guards the API filter logic against silently emptying the results view without explanation.

Key Changes

  1. Robust Price Input Validation (src/components/FiltersSidebar.tsx):

    • Enforced non-negative minimums (min="0") directly on the min/max input elements.
    • Added Math.max(0, ...) logic on input change handlers to automatically clamp negative values.
    • Added an inline validation message ("⚠️ Min price cannot exceed max price.") that appears immediately when minPrice > maxPrice.
    • Wired the invalid state elements with screen-reader accessible aria-invalid attributes and linked them dynamically to the inline validation text using aria-describedby="price-range-error", strictly adhering to accessibility best practices.
  2. Centralized & Premium Validation Styles (src/index.css):

    • Designed elegant input border styling (.filter-input) matching other select form components.
    • Added specific invalid styling (.filter-input--invalid) which turns the input borders red and sets custom high-contrast focus rings when bounds are violated.
  3. Smart Filtering Guard Logic (src/pages/MarketplacePage.tsx):

    • Guarded the backend filtering logic inside useMemo so that when an inverted price range is detected (minPrice > maxPrice), the invalid range is ignored instead of silently removing all APIs from the list.
    • The user's list remains active and visible with other filters applied, while the sidebar points out the input range issue, keeping the UX extremely robust and informative.

Verification Results

  • Ran local package compiler checks and production bundle builds (tsc -b && vite build) which compile cleanly without any warnings or errors.
  • Verified input bounds and validation alerts dynamically adapt across light and dark theme configurations.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 2, 2026

@AugistineCreates Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me
Copy link
Copy Markdown
Contributor

Merged via direct push to main (admin)

@greatest0fallt1me greatest0fallt1me merged commit ef99da5 into CalloraOrg:main Jun 3, 2026
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.

Add validation, range bounds, and inverted-range handling to FiltersSidebar price inputs

2 participants