Skip to content

🎨 Palette: Add aria-invalid to Astro Input component on error#345

Open
daggerstuff wants to merge 7 commits intostagingfrom
palette/ux-input-aria-invalid-9f8d7c-2375291749599319505
Open

🎨 Palette: Add aria-invalid to Astro Input component on error#345
daggerstuff wants to merge 7 commits intostagingfrom
palette/ux-input-aria-invalid-9f8d7c-2375291749599319505

Conversation

@daggerstuff
Copy link
Copy Markdown
Owner

@daggerstuff daggerstuff commented Apr 1, 2026

💡 What: Added aria-invalid attribute to the Input.astro component based on error state\n🎯 Why: Ensures screen readers are properly notified when an input has validation errors\n📸 Before/After: N/A\n♿ Accessibility: Bound aria-invalid state to the existing error boolean prop


PR created automatically by Jules for task 2375291749599319505 started by @daggerstuff


Summary by cubic

Add aria-invalid to src/components/ui/Input.astro when error is true so screen readers announce validation errors. Omit the attribute otherwise; no visual or API changes.

Written for commit 7ed041c. Summary will update on new commits.

Summary by Sourcery

New Features:

  • Expose input validation state via the aria-invalid attribute when the error prop is set.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced accessibility for input fields by properly communicating error states to assistive technologies.

Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
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.

Copilot AI review requested due to automatic review settings April 1, 2026 11:00
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pixelated Ready Ready Preview, Comment Apr 1, 2026 5:57pm

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

The Input.astro component was enhanced to conditionally render the aria-invalid attribute on the input element. When the error prop is truthy, the attribute is set to "true"; otherwise it remains undefined.

Changes

Cohort / File(s) Summary
Accessibility Enhancement
src/components/ui/Input.astro
Added conditional aria-invalid attribute binding to input element based on error prop state.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested reviewers

  • CharlieHelps

Poem

🐰 An input so fine, now speaks with care,
When errors arise, the aria declares,
"Invalid!" it cries with semantic flair,
Accessibility blooms in the digital air! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding aria-invalid attribute to the Input component conditionally based on the error prop.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch palette/ux-input-aria-invalid-9f8d7c-2375291749599319505

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.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 1, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds ARIA invalid state handling to the Astro Input component by binding the existing error prop to an aria-invalid attribute on the underlying element, improving accessibility without changing visual behavior or the public API.

Sequence diagram for Astro Input error state and aria-invalid handling

sequenceDiagram
  actor User
  participant App
  participant AstroInput
  participant Browser
  participant ScreenReader

  User->>App: Submit_form_with_invalid_input
  App->>AstroInput: Render_input(error=true)
  AstroInput->>AstroInput: Bind_error_prop_to_aria_invalid
  AstroInput-->>Browser: Render_input_element(aria-invalid=true)
  Browser-->>ScreenReader: Expose_aria_invalid_state
  ScreenReader-->>User: Announce_input_has_validation_error

  User->>App: Correct_input_value_and_resubmit
  App->>AstroInput: Render_input(error=false)
  AstroInput-->>Browser: Render_input_element_without_aria_invalid
  Browser-->>ScreenReader: Update_accessibility_tree
  ScreenReader-->>User: Stop_announcing_error_for_input
Loading

File-Level Changes

Change Details Files
Bind the existing error prop to the input’s aria-invalid attribute for accessibility.
  • Add conditional aria-invalid attribute to the input element that is set to "true" when error is truthy and omitted otherwise
  • Keep all existing styling and behavior, including error-dependent border and focus ring classes, unchanged
src/components/ui/Input.astro

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

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

No issues found in the modified code. The conditional aria-invalid behavior correctly reflects the error state and avoids emitting the attribute when not needed.

Summary of changes

Summary

  • Updated src/components/ui/Input.astro to conditionally add aria-invalid="true" when the error prop is set (and omit the attribute otherwise).

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Copy link
Copy Markdown

Copilot AI left a comment

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 the accessibility of the shared Input.astro UI component by reflecting its existing error state via the ARIA aria-invalid attribute, allowing assistive technologies to correctly announce invalid inputs.

Changes:

  • Add aria-invalid="true" when the error prop is truthy (and omit the attribute otherwise).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
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.

2 participants