Skip to content

Collapsible error message - #1771

Merged
cocomarine merged 12 commits into
mainfrom
2019-collapsible-error-message
Nov 23, 2026
Merged

cocomarine merged 12 commits into
mainfrom
2019-collapsible-error-message

Conversation

@cocomarine

@cocomarine cocomarine commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/2019
Also closes https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/2013

What's changed

Collapsible error message

  • Turned the error message into a native <details>/<summary> disclosure, open by default.
  • Moved the Python error, the friendly error message and the AI hint inside the collapsible content.
  • Added scrollbar to the content inside the error panel.
    • Due to the behaviour of <details>/<summary>, it was only possible with::details-content selector which was introduced in the last couple of years:
      Screenshot 2026-11-20 at 15 05 05
    • Fallback for old browsers that are not compatible with the selector: used position: sticky with overall scrollbar
      Screenshot 2026-11-20 at 15 05 21

Styling and copy fixes

Accessibility

Error message announcement

  • Added a visually hidden role="status" region that announces "Error running your code" when an error appears.
    • The region is always rendered, outside the error ? … : null check.
    • Focus stays on the Run button as moving focus would be disruptive.

AI hint focus

  • When a hint arrives, the "Generate an AI hint" button is removed along with its focus. Now, focus moves to the result (hint or failure text), which hastabIndex={-1}, so screen readers read it out.
    • On failure, "Try again" is the next Tab stop.
    • Removed aria-live="polite" from the AiErrorMessage wrapper as moving focus already announces the result.

Keyboard and screen reader behaviour

  • The error title is a native <details>/<summary>, so screen readers announce its expanded/collapsed state without extra ARIA.

Screen recordings

Screen.Recording.2026-11-20.at.15.19.37.mov
Screen.Recording.2026-11-20.at.15.11.22.mov

@cocomarine
cocomarine temporarily deployed to previews/1771/merge November 20, 2026 10:25 — with GitHub Actions Inactive
@cocomarine
cocomarine temporarily deployed to previews/1771/merge November 20, 2026 11:17 — with GitHub Actions Inactive
Announce new errors politely without moving focus off the Run button, and move focus to the AI hint result so it isn't lost when the button that had focus is removed.
@cocomarine
cocomarine temporarily deployed to previews/1771/merge November 20, 2026 12:29 — with GitHub Actions Inactive
@cocomarine
cocomarine temporarily deployed to previews/1771/merge November 20, 2026 12:58 — with GitHub Actions Inactive
@cocomarine
cocomarine temporarily deployed to previews/1771/merge November 20, 2026 15:17 — with GitHub Actions Inactive
@cocomarine
cocomarine marked this pull request as ready for review November 20, 2026 15:22
@cocomarine
cocomarine marked this pull request as draft November 20, 2026 15:28
@cocomarine
cocomarine marked this pull request as ready for review November 20, 2026 15:28
@cocomarine

Copy link
Copy Markdown
Contributor Author

@macroscope-app review

@adrian-rpf

Copy link
Copy Markdown
Contributor

@macroscope-app wake up and review

@macroscopeapp

macroscopeapp Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Manual reviews triggered for commit eb2b3dd:

All prior checks · these links stay valid even if you push more commits.

@macroscopeapp

macroscopeapp Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Review started; results will appear in the PR checks.

@macroscopeapp

macroscopeapp Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Would Approve

Macroscope's review found this PR approvable — Runtime errors become collapsible while remaining expanded by default, with updated styling and accessible announcements and hint focus. The changes are limited to presentation and interaction, retaining existing sanitization and AI request controls.

Needs human approval because:

  • approvability is in preview mode for this repository — Macroscope would have approved this PR outside preview mode

No code changes detected at da50d9e. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@jamiebenstead jamiebenstead 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.

LGTM

@cocomarine
cocomarine merged commit a1d2857 into main Nov 23, 2026
13 checks passed
@cocomarine
cocomarine deleted the 2019-collapsible-error-message branch November 23, 2026 14:01

This branch was successfully deployed

1 active deployment
previews/1771/merge — da50d9e2 Deployed Nov 23, 2026 by cocomarine via deploy-branch / build-deploy #7214
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