Skip to content

Comments

fix: Improve accessibility for payment form screen reader support#473

Open
naeema-scopes wants to merge 1 commit intosquare:masterfrom
naeema-scopes:fix/accessibility-payment-form-issue-100
Open

fix: Improve accessibility for payment form screen reader support#473
naeema-scopes wants to merge 1 commit intosquare:masterfrom
naeema-scopes:fix/accessibility-payment-form-issue-100

Conversation

@naeema-scopes
Copy link

Fixes #100

Problem

Users with screen readers (VoiceOver/TalkBack) cannot properly edit payment form fields. The form appears to select fields but focus doesn't actually move, making it impossible to edit values.

Solution

Added proper ARIA attributes across all payment form templates:

  • Apple/Google Pay buttons: Added role="button", aria-label, and tabindex="0" for keyboard/screen reader access
  • Card container: Added role="group" and aria-label to provide context for the credit card input area
  • OR separators: Added aria-hidden="true" to hide decorative elements from screen readers
  • Status messages: Added role="status" and aria-live="polite" so payment confirmations are announced
  • Error messages: Added role="alert" and aria-live="assertive" for immediate error announcements

Files Changed

  • connect-examples/v2/java_payment/src/main/resources/templates/index.html
  • connect-examples/v2/rails_payment/app/views/welcome/index.html.erb
  • connect-examples/v2/node_payment/views/index.pug
  • connect-examples/v2/node_orders-payments/views/checkout/payment.pug

Testing

These changes follow WCAG 2.1 AA guidelines and WAI-ARIA best practices.

Note

The card input fields themselves are rendered by Square's Web Payments SDK (window.payments.card()), so the core focus issue may require SDK-level fixes. However, these template improvements provide better context and navigation for screen reader users.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.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.

Accessibility Issue: Cannot edit form fields using mobile screen readers

2 participants