Skip to content

Commit

Permalink
Closing the tabs with middle mouse button
Browse files Browse the repository at this point in the history
  • Loading branch information
KoStard committed Feb 19, 2022
1 parent 6819e01 commit c943838
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/PageTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ const Tabs = React.forwardRef<HTMLElement, TabsProps>(
data-dragging={draggingTab != null}
className={`flex items-center h-full px-1`}
style={{ width: "fit-content" }}
// By default middle button click will enter the horizontal scroll mode
onMouseDown={e => { if (e.button === 1) e.preventDefault(); }}
>
{tabs.map((tab) => {
const isActive = isTabEqual(tab, activePage);
Expand Down Expand Up @@ -108,6 +110,7 @@ const Tabs = React.forwardRef<HTMLElement, TabsProps>(
return (
<div
onClick={() => onClickTab(tab)}
onAuxClick={onClose}
onDoubleClick={() => onPinTab(tab)}
onContextMenu={(e) => {
e.preventDefault();
Expand Down

0 comments on commit c943838

Please sign in to comment.