Merge pull request #34395 from overleaf/mj-tabs-disable-close-button

[web] Disable close tab button on last tab

GitOrigin-RevId: 2d4600162696b07848311e75154d9d86aac0b315
This commit is contained in:
Mathias Jakobsen
2026-06-09 08:06:23 +00:00
committed by Copybot
parent dedc521295
commit 748bdfd59d
4 changed files with 19 additions and 10 deletions
@@ -26,6 +26,7 @@ type TabProps = {
tab: EditorFileTab
openTab: (id: string) => void
closeTab: (id: string) => void
canCloseTab: boolean
makeTabPermanent: (id: string) => void
openContextMenu: (
coords: { top: number; left: number },
@@ -56,6 +57,7 @@ export const Tab = memo(function Tab({
tab,
openTab,
closeTab,
canCloseTab,
makeTabPermanent,
openContextMenu,
closeContextMenu,
@@ -233,6 +235,7 @@ export const Tab = memo(function Tab({
<div className="editor-file-tab-action">
<button
onClick={onCloseClick}
disabled={!canCloseTab}
className="editor-file-tab-close-action"
aria-label={t('close')}
>
@@ -106,6 +106,7 @@ export const TabsContainer = () => {
tab={tab}
openTab={openTab}
closeTab={closeTab}
canCloseTab={tabs.length > 1}
isSelected={openEntity?.entity._id === tab.id}
onTabDrop={moveTab}
makeTabPermanent={makeTabPermanent}