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

Voiceover announcement and programmatic association to field #54

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

maria-gourevitch
Copy link

  1. Add role=text on the actual number of words. This reduces the changes of Voiceover (especially on MacOS) garbling the announcement.
  2. Programmatically associate the counter with the text field. This will allow screen reader users to hear this information when they focus in the field (either right away or by asking for more details, depending on their screen reader settings). This is to support WCAG success criterion 1.3.1 Info & Relationships, using advisory technique ARIA1

maria-gourevitch and others added 6 commits August 10, 2023 12:01
This should prevent VoiceOver announcing just "remaining" (VoiceOver has a well-known issue where it does not announce the entire element  when there are inline tags).  There should be no effect on other screen readers.
…is a conflict with the auto-generated ID). Use it to programmatically associate counter with textarea.
…avoid random-sounding announcements on ajax submissions (observed in Drupal 9).
…s helps avoid random-sounding announcements on ajax submissions (observed in Drupal 9)."

This reverts commit d1f8844.
Copy link
Owner

@ractoon ractoon left a comment

Choose a reason for hiding this comment

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

Hi @maria-gourevitch,

This is great! Just had a couple small comments, but this would be very helpful to merge into the project.

@@ -135,7 +135,7 @@ countOverflowText : "Maximum %type exceeded by %d", // count overflow
countOverflowContainerClass : "text-count-overflow-wrapper", // class applied to the count overflow wrapper
minDisplayCutoff : -1, // maximum number of characters/words above the minimum to display a count
maxDisplayCutoff : -1, // maximum number of characters/words below the maximum to display a count

counterId' : null, // custom ID for the counter element (e.g. to prevent conflicts). If one is not provided, a default ID will be assigned based on the ID of the element.
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
counterId' : null, // custom ID for the counter element (e.g. to prevent conflicts). If one is not provided, a default ID will be assigned based on the ID of the element.
counterId : null, // custom ID for the counter element (e.g. to prevent conflicts). If one is not provided, a default ID will be assigned based on the ID of the element.

@@ -21,12 +21,14 @@
base.init = function() {
base.options = $.extend({}, $.textcounter.defaultOptions, options);

var counterElementId = base.options.counterId ?? base.el.id + '_counter';
Copy link
Owner

@ractoon ractoon Sep 16, 2023

Choose a reason for hiding this comment

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

My only concern with setting it this way is if there are multiple instances on a page, with an empty ID, then this would create duplicate IDs. Perhaps something like jQuery UIs uniqueId function behavior could be duplicated here instead: https://github.com/jquery/jquery-ui/blob/1be45388176080418aef84f3c98fda2c10fcdc42/ui/unique-id.js#L43

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