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

Link focusable static math textarea with mathspeak region through ARIA #311

Merged
merged 5 commits into from
Oct 22, 2024

Conversation

sclower
Copy link

@sclower sclower commented Oct 16, 2024

This PR makes two subtle changes to focusable static math:

  1. Use the "aria-labelledby" attribute to link the focusable static math textarea element with its accompanying mathspeak region.
  2. Explicitly remove the empty aria-label attribute for focusable static math because the attribute is now redundant. I believe this also solves a problem observed only in JAWS for Windows where focusable static math wasn't readable in the Desmos calculators where such fields are used (e.g. evaluations and computed table cells).

We were setting the aria-label attribute of focusable static math textareas to an empty string, which might explain some issues observed in JAWS. THis approach uses aria-labelledby to connect the textarea to the offscreen mathspeak span for focusable static math which appears to resolve the problem.
@sclower sclower requested a review from eluberoff October 16, 2024 15:26
src/services/textarea.ts Outdated Show resolved Hide resolved
const r = (Math.random() * 16) | 0;
const v = c === 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
Copy link
Member

Choose a reason for hiding this comment

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

I don't feel particularly confident with the right approaches to forming a uuid. I wonder about the alternative instead where there's some global value that increments. Would love someone else to review this part! Test looks great and the behavior makes sense.

Copy link
Author

Choose a reason for hiding this comment

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

Will do. I chose to write this inline rather than add another build dependency. Using the internal id won't work, though, in the case where multiple MQ instances might be set up on the same page.

textarea[0].getAttribute('aria-labelledby'),
mathspeakId,
'textarea is aria-labelledby mathspeak region'
);
Copy link
Member

Choose a reason for hiding this comment

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

beautiful test

@jared-hughes
Copy link

If we need a page-globally-unique ID, then UUID does sound like the way to go, rather than a globally incrementing ID since we can't guarantee that the MQ instance is the only one on the page.

Why is this needed on focusable static math but not on editable math? They should have the same textarea setup.

@sclower
Copy link
Author

sclower commented Oct 21, 2024

@jared-hughes I think this is ready now. Care to give it another pass?

Copy link

@jared-hughes jared-hughes left a comment

Choose a reason for hiding this comment

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

Looks good!

@sclower sclower merged commit a7fed4a into main Oct 22, 2024
3 checks passed
@sclower sclower deleted the sclower/link-focusable-static-math-and-textarea-aria branch October 22, 2024 19:11
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.

3 participants