ui: restore the clickable toast the migration dropped

No, it did not still work.  Semantic's toast took an `onClick` in its
options and made the whole toast activate it.  The migrated helper
destructured four keys and dropped the rest, silently, so every toast that
carried one became a dead toast.

`Events.js` still passes one -- it did before the migration and was never
changed -- for the three events that arrive with a URL:

* `user_notify_message`, a page shared from the browser extension
* `upload_archive`
* `screenshot_generated`

The first renders the description "Click here to view the shared page",
which it was not.  Nothing threw and nothing looked wrong; the toast
simply stopped being a way to reach the thing it was announcing.

`onClick` is passed through again, and a toast carrying one gets a pointer
cursor so it looks like what it is.  Clicks on the dismiss button do not
follow it -- the button is inside the toast, so its click reaches the root,
and closing a notification is not the same as following it.

It is also reachable from the keyboard now, which it never was: WROLPi runs
on devices with a keyboard and no mouse, and a toast only a pointer can
follow is a feature half the deployments cannot use.  No `role`, because a
`button` or `link` role may not contain interactive content and the dismiss
button is in there.

Mantine also leaves that dismiss button unnamed, so a screen reader read it
as "button".  It has a label now, which is how the test for the
dismiss-does-not-follow case can find it.

Five tests, all red first.  The gallery gets a Clickable button; following
the toast raises a second one, so it is obvious whether the handler ran.
This commit is contained in:
Roland 2026-08-01 14:58:21 -06:00
parent 213b940a1b
commit de0f70eefc
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
3 changed files with 124 additions and 2 deletions

View file

@ -276,6 +276,14 @@ export function ThemeSamplePage() {
+ 'keeps/going/for/a/while.html: the remote server closed the '
+ 'connection after sending part of the response body.',
})}>Long text</Button>
{/* Events.js sends three of these, each opening a URL. Click the toast
body, or Tab to it and press Enter; the dismiss button does not follow. */}
<Button role='cancel' onClick={() => toast({
type: 'info', title: 'Screenshot Generated',
description: 'Click here to view it.',
time: 10000,
onClick: () => toast({type: 'success', title: 'Followed the toast'}),
})}>Clickable</Button>
<Button role='danger' onClick={() => clearToasts()}>Clear all</Button>
</Row>