feat(app): add middle-click to close tabs in review sidebar (#7094)

This commit is contained in:
Justas Raudonius 2026-01-06 18:15:17 +02:00 committed by GitHub
commit 49d837e0c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 0 deletions

View file

@ -13,6 +13,7 @@ export interface TabsTriggerProps extends ComponentProps<typeof Kobalte.Trigger>
}
hideCloseButton?: boolean
closeButton?: JSX.Element
onMiddleClick?: () => void
}
export interface TabsContentProps extends ComponentProps<typeof Kobalte.Content> {}
@ -55,6 +56,7 @@ function TabsTrigger(props: ParentProps<TabsTriggerProps>) {
"children",
"closeButton",
"hideCloseButton",
"onMiddleClick",
])
return (
<div
@ -63,6 +65,12 @@ function TabsTrigger(props: ParentProps<TabsTriggerProps>) {
...(split.classList ?? {}),
[split.class ?? ""]: !!split.class,
}}
onAuxClick={(e) => {
if (e.button === 1 && split.onMiddleClick) {
e.preventDefault()
split.onMiddleClick()
}
}}
>
<Kobalte.Trigger
{...rest}