Skip to content

Modals: corner close button on every dialog, and open the EEG viewer in one #199

Closed

Description

@neuromechanist

Two related pieces of dialog work.

1. Every modal needs a corner close button

Today the native <dialog>s on the dataset page close via a bottom-mounted text button:

<form method="dialog">
  <button type="submit" class="dialog-close">Close</button>
</form>

That works, and Esc works (native <dialog> behaviour), but there is no X in the top-right corner where people look first. On the long dialogs the Close button is below the fold, so the only discoverable exit is Esc, which not everyone knows.

Affected today (src/components/ActionBar.astro):

  • [data-download-dialog] — Download this dataset
  • [data-compute-dialog] — Compute on this dataset
  • [data-citations-dialog] — Citations

Plus src/components/ConfirmDialog.astro (its Cancel button is the equivalent affordance; confirm whether an X is right there or whether Cancel already covers it) and the role="dialog" popover in src/components/ProvenanceToggle.astro.

Ask: a shared, theme-aware corner close affordance, used by every dialog rather than re-styled per file. Keep the existing bottom Close button where it reads as a natural end-of-content action; the X is an addition, not a replacement. Keep Esc working. aria-label="Close" on the X, and it must be reachable and visible on keyboard focus.

2. The EEG viewer should open in a full-screen modal

The Zarr signal viewer currently mounts inline, into a slot inside the BIDS file tree row (src/pages/dataset/[id].astro, the previewType === "eeg" branch calling mountEegViewer). A multi-channel scope squeezed into a tree row is the wrong shape for the content: channels are cramped and the time axis is short.

Ask: open it in the same modal treatment the other dialogs use, sized to roughly 70% of the viewport, with the corner close button from part 1.

Constraints worth stating up front:

  • Keep the code-split. The viewer + zarrita bundle must still load only when a signal file is first opened, not on page load.
  • Keep every existing failure path intact: zarrAvailable === "false" with its zarrFailureReason, the mount-failed catch with the download fallback, and the aria-busy / data-loaded slot state machine that prevents concurrent fetches on rapid re-open.
  • The viewer sizes itself to its container; verify it lays out correctly at modal size rather than assuming it reflows for free.
  • Closing the modal should not orphan the viewer instance or leave a streaming fetch running. Check what mountEegViewer returns and whether there is a teardown path; if there isn't, add one.
  • Both themes, per the tokens rule in AGENTS.md.

Related: #109 (auto-scale initial gain) touches the same viewer but is independent; whichever lands second rebases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions