Skip to content

Improvement/lighthouse accessibility changes - #2295

Draft
ioiototm wants to merge 13 commits into
mainfrom
improvement/lighthouse-accessibility-changes
Draft

Improvement/lighthouse accessibility changes#2295
ioiototm wants to merge 13 commits into
mainfrom
improvement/lighthouse-accessibility-changes

Conversation

@ioiototm

Copy link
Copy Markdown
Contributor

This pull request covers most of the accessibility issues raised by @jacbn with Lighthouse on the 3rd of August.

Most of the changes are small, h3 -> span/div, adding aria-labels, etc.

The big change is in the MyAccount file, where a few helper functions have been added in order to make the tab selection accessible:

  1. Once you have focus on the tab list, you can use left or right to travel, and you have to press space or enter to select. I haven't done automatically selecting the tabs since there is a possibility of a pop up in case of unsaved changes.
  2. Home/End put the cursor at the start or end of the tab list (although, on MacOS it's not working, since Mac does the keys as Command+Left/Right).

This is following the standard at MDN.

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.63158% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.54%. Comparing base (648454a) to head (cb18940).
⚠️ Report is 31 commits behind head on main.

Files with missing lines Patch % Lines
src/app/components/pages/MyAccount.tsx 55.55% 24 Missing ⚠️
src/app/components/elements/SearchInputs.tsx 0.00% 2 Missing ⚠️
src/app/components/elements/cards/PromptBanner.tsx 0.00% 2 Missing ⚠️
...ponents/elements/inputs/InlineNumericEntryZone.tsx 33.33% 2 Missing ⚠️
...mponents/elements/inputs/InlineStringEntryZone.tsx 33.33% 2 Missing ⚠️
src/app/components/elements/Accordion.tsx 0.00% 1 Missing ⚠️
...s/elements/alerts/LLMFreeTextQuestionInfoAlert.tsx 0.00% 1 Missing ⚠️
...nts/elements/modals/inequality/InequalityModal.tsx 0.00% 1 Missing ⚠️
.../components/elements/panels/TeacherConnections.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2295      +/-   ##
==========================================
+ Coverage   43.18%   43.54%   +0.36%     
==========================================
  Files         601      602       +1     
  Lines       25741    25806      +65     
  Branches     7666     8592     +926     
==========================================
+ Hits        11116    11238     +122     
+ Misses      14576    14511      -65     
- Partials       49       57       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sjd210 sjd210 left a comment

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.

I think you've done a good job here, but unfortunately they were both a lot of things to find and some subtleties that need some more knowledge of accessibility/our codebase.

If you've got any questions about the changes I'm requesting, please do feel free to drop a message and ask 😊


Quick list of individual violations I found on the reviewed pages when re-running lighthouse tests. I think it makes sense to also bundle fixes for them here:

  • This question finder button on <=md screens (Note that the <i> within it is aria-hidden, but the button itself should still be labelled)
  • Theses h4s for IsaacReorderQuestion (and the equivalent ones for IsaacParsonsQuestion)
  • The title tag for modal headers (although be careful here because undefined sets them to <h5>. We need to set a non-<h*> tag manually and then ensure that .modal-title has correct styling by itself on both sites)
  • All the <h*>s in related questions, including the fact that there are <h4> as direct children of a <ul> (<ListGroup>). Only <li> should be children here, so we should extract those.
  • Topic headers
  • Assignment card titles

There are also definitely a lot more issues with most other <h*> uses in the codebase, but not in the pages that were tested for the report - so I'm collating those for another card.

Also have you intentionally not addressed "The user's focus is directed to new content added to the page - when questions are listed, focus remains on the "Apply filters" button"? If so that's fine, I'd just like to make sure its recorded somewhere.

Comment thread src/app/components/pages/MyAccount.tsx Outdated
return <MyAccountTab
leftColumn={<>
<h3>Account details</h3>
<h2>Account details</h2>

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.

This make sense logically to be <h2>, but visually it looks off - especially on Isaac where this makes this heading bigger than the actual <h1> page heading.

I think we can keep the rank logic, but also maintain the styling. i.e.

Suggested change
<h2>Account details</h2>
<h2 className="h3">Account details</h2>

Also, Lighthouse doesn't catch this because it only does an initial page load, but this <h3> is an issue for every tab on the My Account page. In reality we care beyond just the page load, so they should all have the same treatment as this.

Comment thread src/app/components/site/cs/HeaderCS.tsx Outdated
Comment thread src/app/components/pages/MyAccount.tsx Outdated
{/* the key above ensures that any state inside tabs is reset to initial values if activeTab is changed while accountInfo is dirty
(i.e. user has unsaved changes they do *not* want to commit) */}
<TabPane tabId={ACCOUNT_TAB.account}>
<TabPane tabId={ACCOUNT_TAB.account}{...tabPanelProps(ACCOUNT_TAB.account)}>

@sjd210 sjd210 Aug 14, 2026

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.

I've got a couple suggestions about these props:

  1. There's slight redundancy, but I'd rather we keep these props actually local to their object, so one doesn't need to scroll back and forth to find out values when maintaining this code.
  2. Since it's an enum value, just using the ACCOUNT_TAB directly is making the id contain a number rather than title, which isn't very descriptive. We'd rather it be intuitive which id belongs to which object.
  3. Not here, but it would be nice if the NavLink has an aria-controls property linking to this id to make the connection two-way.

Something like this should do to cover the first two of these points for this pane specifically, but there are changes to make in several places if you want to implement this.

Suggested change
<TabPane tabId={ACCOUNT_TAB.account}{...tabPanelProps(ACCOUNT_TAB.account)}>
<TabPane
tabId={ACCOUNT_TAB.account} id={`account-panel-${ACCOUNT_TABS[ACCOUNT_TAB.account].title.toLowerCase()}`}
{...(isAda && {"role": "tabpanel", "aria-labelledby": `account-tab-${ACCOUNT_TABS[ACCOUNT_TAB.account].title.toLowerCase()}`})}
>

@ioiototm

Copy link
Copy Markdown
Contributor Author

I have started implementing the changes you requested, which I agree with all of them.

I knew about the div being empty and still added the aria-hidden since the lighthouse report was complaining about that, but if you think it's being overly twitchy on that, then we can undo that change.

I've tried doing the account tab stuff, and I made it so it has a slug function, and replaces the space with "-" since if a tab contained more than a single word, the space would break the tag.

I went through all the user tabs and tried to fix the headings, I think I got everything.

I am starting the work on the other headings you mentioned, I haven't done anything with them.

And for the final thing, the about the user focus, I haven't done that, it must have slipped my checks, I will look into that as well.

@ioiototm
ioiototm marked this pull request as draft August 19, 2026 12:41
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.

4 participants