Open in Slicer: launch slicer programmatically from dropdown items.
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Controller Tests / controller-tests (push) Waiting to run
Jest Tests / jest-tests (push) Waiting to run

Semantic UI may activate a Dropdown.Item from the keyboard without
following its href, which would save the slicer preference without
launching the slicer. Prevent the default anchor navigation and call
window.location.assign() so every activation path behaves the same.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-04 12:23:23 -06:00
parent a580317911
commit 85bd5619fa
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680

View file

@ -72,7 +72,13 @@ function OpenInSlicerButton({previewFile}) {
{SLICERS.map(s =>
<Dropdown.Item key={s.key} text={`Open in ${s.text}`}
as='a' href={getSlicerURL(previewFile, s.scheme)}
onClick={() => setSlicerKey(s.key)}/>)}
onClick={(e) => {
// Navigate programmatically so keyboard activation (which may not
// follow the href) still launches the slicer.
if (e) e.preventDefault();
setSlicerKey(s.key);
window.location.assign(getSlicerURL(previewFile, s.scheme));
}}/>)}
</Dropdown.Menu>
</Dropdown>
</SButton.Group>