Skip to content

SL-346: add accessibility improvements for EAA compliance#320

Open
GytisZum wants to merge 1 commit intoSL-358/payment-fieldfrom
SL-346/accessibility-eaa-compliance
Open

SL-346: add accessibility improvements for EAA compliance#320
GytisZum wants to merge 1 commit intoSL-358/payment-fieldfrom
SL-346/accessibility-eaa-compliance

Conversation

@GytisZum
Copy link
Copy Markdown
Collaborator

Self-Checks

  • I have performed a self-review of my code.
  • I have updated/added necessary technical documentation in the README file.

JIRA task link

Summary

QA Checklist Labels

  • Bug fix?
  • New feature?
  • Improvement?
  • Technical debt?
  • Reusable?
  • Covered by tests?

QA Checklist

Additional Context

Frontend Changes

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the application's accessibility to meet EAA compliance standards. The changes focus on making the user interface more navigable and understandable for users relying on assistive technologies, by providing clearer semantic structures and interactive feedback across key components like forms, modals, and payment processes.

Highlights

  • Accessibility Improvements (EAA Compliance): Implemented various changes to enhance accessibility across the application, focusing on EAA compliance. This includes adding ARIA attributes, improving keyboard navigation, and ensuring better screen reader support for interactive elements.
  • Enhanced Modal Interaction: Improved the log modal's accessibility by adding a dedicated close button, enabling keyboard navigation (Escape key to close), and ensuring focus management when opening and closing the modal.
  • ARIA Attribute Integration: Introduced aria-label, aria-modal, aria-labelledby, role, and aria-live attributes to various components such as buttons, input fields, modals, iframes, images, and loading indicators to provide better context for assistive technologies.
  • UI Element Refinements: Updated several UI elements, including changing a 'View' div to a button, converting a payment link to a button, and wrapping radio inputs in labels for improved semantic structure and usability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a comprehensive set of accessibility improvements across various templates and JavaScript files. Key changes include enhancing form element labeling, providing descriptive aria-label and alt attributes, improving modal dialog semantics with ARIA roles, and ensuring interactive elements like buttons are semantically correct. These changes significantly improve the user experience for individuals using assistive technologies, aligning the application with better accessibility standards.

Comment on lines +24 to +30
function closeModal($modal) {
$modal.removeClass('open');
var triggerButton = $modal.data('triggerButton');
if (triggerButton) {
triggerButton.focus();
}
}
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.

medium

The closeModal function correctly handles closing the modal and returning focus to the trigger button. This is a crucial accessibility pattern for modal dialogs, ensuring keyboard users can easily navigate back to their previous context.

Comment on lines +42 to +49
$(document).on('keydown', function (event) {
if (event.key === 'Escape') {
var $openModal = $('.modal.open');
if ($openModal.length) {
closeModal($openModal);
event.preventDefault();
}
}
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.

medium

Implementing the 'Escape' key to close the modal is an excellent accessibility feature, providing an intuitive way for keyboard users to dismiss the dialog.

// NOTE: opening modal
$('#' + $(this).data('target')).addClass('open');
$modal.addClass('open');
$modal.find('.js-log-modal-close').focus();
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.

medium

Setting focus to the close button when the modal opens is a good practice for accessibility, as it immediately places the user's focus within the modal and provides an obvious way to exit.

type="button"
onClick={() => setShowApiPassword(!showApiPassword)}
className="sp-absolute sp-right-3 sp-top-1/2 sp--translate-y-1/2 sp-text-muted-foreground hover:sp-text-foreground sp-transition-colors"
className="sp-absolute sp-right-3 sp-top-1/2 sp--translate-y-1/2 sp-text-muted-foreground hover:sp-text-foreground sp-transition-colors sp-p-1 sp-min-w-[24px] sp-min-h-[24px] sp-flex sp-items-center sp-justify-center"
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.

medium

Adding sp-p-1 sp-min-w-[24px] sp-min-h-[24px] sp-flex sp-items-center sp-justify-center to the password toggle button improves its clickable area and visual consistency, which enhances usability and accessibility for users with motor impairments or those using touch interfaces.


<div className="sp-flex sp-justify-end">
<Button className="sp-min-w-[120px]" onClick={saveCredentials} disabled={saving}>
<Button className="sp-min-w-[120px]" onClick={saveCredentials} disabled={saving} aria-label={saving ? t('saving') : undefined}>
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.

medium

Adding a dynamic aria-label to the save button that indicates its 'saving' state provides crucial feedback for screen reader users, improving the accessibility of the form submission process.

Comment on lines +39 to +41
<button type="submit" class="btn btn-default button button-medium">
<span>{l s='Pay' mod='saferpayofficial'}<i class="icon-chevron-right right"></i></span>
</a>
</button>
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.

medium

Changing the <a> tag to a <button type="submit"> is a crucial semantic and accessibility improvement. Buttons are designed for actions like form submission, providing correct semantics and expected behavior for assistive technologies.

Comment on lines +28 to +33
<label>
<input type="radio" name="saved_card_{$paymentMethod|escape:'htmlall':'UTF-8'}" value="{$savedCard['id_saferpay_card_alias']|escape:'htmlall':'UTF-8'}"
{if $selected }checked="checked" {$selected = 0}{/if}
>
<span>{$savedCard['card_number']|escape:'htmlall':'UTF-8'}</span>
</label>
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.

medium

Wrapping each radio input and its associated text within a <label> tag is the correct and most accessible way to associate labels with radio buttons. This makes the entire label clickable and improves usability for all users.

Comment on lines +37 to +42
<label>
<input type="radio" name="saved_card_{$paymentMethod|escape:'htmlall':'UTF-8'}" value="0"
{if $selected }checked="checked"{/if}
>
<span>{l s='Use new card and save it' mod='saferpayofficial'}</span>
</label>
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.

medium

Wrapping each radio input and its associated text within a <label> tag is the correct and most accessible way to associate labels with radio buttons. This makes the entire label clickable and improves usability for all users.

Comment on lines +45 to 49
<label>
<input type="radio" name="saved_card_{$paymentMethod|escape:'htmlall':'UTF-8'}" value="-1">
<span>{l s='Use new card once' mod='saferpayofficial'}</span>
</label>
</div>
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.

medium

Wrapping each radio input and its associated text within a <label> tag is the correct and most accessible way to associate labels with radio buttons. This makes the entire label clickable and improves usability for all users.


<div>
<iframe id="test-frame" src=''></iframe>
<iframe id="saferpay-payment-frame" src='' title="{l s='Saferpay payment form' mod='saferpayofficial'}"></iframe>
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.

medium

Changing the iframe id to saferpay-payment-frame and adding a descriptive title attribute are good practices. The title attribute is particularly important for accessibility, providing context for screen reader users about the iframe's content.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

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