Skip to content

Commit 2710137

Browse files
committed
Disable Go to Selection when there is no selection
1 parent 90c034b commit 2710137

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

web/src/lib/components/menu-bar/MenuBar.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@
123123
<Menubar.Portal>
124124
<Menubar.Content class="z-20 border bg-neutral text-sm" align="start">
125125
<Menubar.Item
126-
class="btn-ghost px-2 py-1 select-none"
126+
class="data-disabled:cursor-notallowed btn-ghost px-2 py-1 select-none data-disabled:pointer-events-none data-disabled:text-em-disabled"
127+
disabled={viewer.selection === undefined}
127128
onSelect={() => {
128129
if (viewer.selection) {
129130
viewer.scrollToFile(viewer.selection.file.index, {
@@ -133,8 +134,10 @@
133134
viewer.jumpToSelection = true;
134135
}
135136
}
136-
}}>Go to Selection</Menubar.Item
137+
}}
137138
>
139+
Go to Selection
140+
</Menubar.Item>
138141
</Menubar.Content>
139142
</Menubar.Portal>
140143
</Menubar.Menu>

0 commit comments

Comments
 (0)