[DREAM-833] Declare WP heading as heading level 2 - #25518
lwassermann wants to merge 5 commits into
Conversation
a612439 to
eb8431d
Compare
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Adds accessible level-2 heading semantics to the work package subject while preserving its existing editing behavior.
Changes:
- Adds
role="heading"andaria-level="2"to the subject container.
| File | Summary |
|---|---|
frontend/src/app/features/work-packages/components/wp-subject/wp-subject.html |
Declares the subject container as an ARIA level-2 heading. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
6187f4b to
0983c4a
Compare
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
There was a problem hiding this comment.
I've only checked this "statically" so far (not in the accessibility tree) – but the solution looks good!
The only caveat (which I need to read up on): with some other ARIA roles (e.g. listbox, grid, best practices can allow/disallow certain elements in the element's subtree. I'm not sure whether this is the case for role="heading" - e.g. disallowing nested attributes. – @bsatarnejad may know more?
I'm requesting changes because I'd like to see some sort of test coverage added.
There are a couple different options here:
- add a frontend (vitest) spec for
wp-subject.component: since there is no existing spec, this might be a good exercise in adding specs for legacy Angular components. This component is very simple, so the amount of setup to bootstrap (viaTestBed) should be minimal. Fortunately agents are also pretty adept at writing frontend specs. - update some or all feature specs that currently find this header text via CSS (i.e.
have_css(".work-packages--details--subject", text:) to find by semantic role instead (e.g.have_heading(text, level: 2)). I'm personally a big proponent of driving specs by semantic and accessibility metadata (CSS is an implementation detail that shouldn't leak into the spec suites IMHO).
Useful resources:
I'd personally go for both – if time permits - since testing at these different levels serves different purposes.
0983c4a to
dfb55bc
Compare
|
I've adjusted the existing backend tests and added a new test suite for wp-subject. Please have a look @myabc |
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
8adac87 to
e1f43fc
Compare
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
myabc
left a comment
There was a problem hiding this comment.
@lwassermann thanks for adding the specs! – this is looking better, but there are still a number of issues that need to be worked through.
So that it appears in screenreader heading menues. We can not make the element an h2, because h2 only allow for phrase content, and neither div nor form are that. Both of which are used for the inline editing form. We need to use an explicit aria label, because the elements text content includes the edit-field button translation: "Subject _value_: edit", which is not desired. https://community.openproject.org/wp/DREAM-833
Co-authored-by: Alexander Brandon Coles <alex@alexbcoles.com>
Co-authored-by: Alexander Brandon Coles <alex@alexbcoles.com>
8ddc521 to
91a6e5b
Compare
| const subject = 'Add some angular tests for wp-subject'; | ||
| render({ subject }); | ||
|
|
||
| fireEvent.click(screen.getByRole('button', { name: `subject ${subject}`})); |
There was a problem hiding this comment.
(thinking aloud) should we wait for the form to appear? just to check it doesn't clobber the heading somehow? or would that be like testing for the absence of something – too defensive?
myabc
left a comment
There was a problem hiding this comment.
thanks both for delving into this! @bsatarnejad @lwassermann 💙
good to merge once CI is green.
Ticket
https://community.openproject.org/wp/DREAM-833
What are you trying to accomplish?
So that it appears in screenreader heading menus.
We can not make the element an h2, because h2 only allow for phrase content, and neither div nor form are that. Both of which are used for the inline editing form.
Thank you Alex for pointing this out.
Screenshots
Unchanged
What approach did you choose and why?
Add the explicit role and aria level to the HTML element
AI involvement
None/Assisted – No AI assistance used OR only autocomplete/pasted snippets. I effectively wrote and understand all the code.
Merge checklist