mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-21 07:26:18 -05:00
Open in Slicer: launch slicer programmatically from dropdown items.
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:
parent
a580317911
commit
85bd5619fa
1 changed files with 7 additions and 1 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue