Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #3505451 by richardgaunt, fionamorrison23, alan.cole: Errors are not linking to error messages in radios and checkboxes #1335

Merged
merged 6 commits into from
Feb 20, 2025

Conversation

richardgaunt
Copy link
Collaborator

@richardgaunt richardgaunt commented Feb 13, 2025

Checklist before requesting a review

  • I have formatted the subject to include ticket number as Issue #123456 by drupal_org_username: Issue title
  • I have added a link to the issue tracker
  • I have provided information in Changed section about WHY something was done if this was not a normal implementation
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have run new and existing relevant tests locally with my changes, and they passed
  • I have provided screenshots, where applicable

Changed

  1. Updated preprocessing to pass attributes for error message and added aria-described-by to the form element to point to the message

See civictheme/uikit#480 for UI Kit update

Screenshots

Updated preprocessing with new field.twig template
image

$element_id = $element['#id'] ?? $element['#attributes']['data-drupal-selector'] ?? '';
if (!empty($element_id)) {
$element_id .= '--error-message';
$variables['message']['attributes'] = new Attribute(['id' => $element_id]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note we add the ID for the message and the aria-described-by for the form element

@richardgaunt richardgaunt added the State: Needs review Pull requests needs a review from assigned developers label Feb 13, 2025
@github-actions github-actions bot added State: CONFLICT and removed State: Needs review Pull requests needs a review from assigned developers labels Feb 19, 2025
@richardgaunt richardgaunt changed the title Issue #3505451 by richardgaunt, fionamorrison23: Errors are not linking to error messages in radios and checkboxes Issue #3505451 by richardgaunt, fionamorrison23, alan.cole: Errors are not linking to error messages in radios and checkboxes Feb 20, 2025
@richardgaunt richardgaunt merged commit 37a7822 into develop Feb 20, 2025
3 checks passed
@richardgaunt richardgaunt deleted the feature/improve-error-messages branch February 20, 2025 08:45
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