[ENG-433] removeTab on middle click (#1802)

removeTab on middle click
This commit is contained in:
Brendan Allan 2023-11-21 16:31:47 +11:00 committed by GitHub
parent a827fa382d
commit 5e3802a424
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -109,7 +109,10 @@ function Tabs() {
>
{ctx.tabs.map(({ title }, index) => (
<button
onClick={() => ctx.setTabIndex(index)}
onClick={(e) => {
if (e.button === 0) ctx.setTabIndex(index);
else if (e.button === 1) removeTab(index);
}}
className={clsx(
'duration-[50ms] group relative flex h-full min-w-[10rem] shrink-0 flex-row items-center justify-center px-8 text-center',
ctx.tabIndex === index