# Tabmail Tabmail is Thunderbird's tab UI mechanism, responsible for the tab toolbar, opening, closing, switching and reordering tabs, and saving and restoring the current tabs when required. It is somewhat analogous to Firefox's `tabbrowser` but evolved separately. Some of the code exists purely to avoid things breaking when toolkit code expects to find `tabbrowser` but instead gets `tabmail`. The main difference from Firefox is that Thunderbird supports different _types_ of tab, whereas Firefox only has tabs for displaying web pages. ```{note} This is just an overview. There's a large comment in [tabmail.js](https://searchfox.org/comm-central/source/mail/base/content/tabmail.js) with much more detail. ``` ## Useful properties - `tabbox` - the element containing the content of all tabs - `panelContainer` - the toolbar containing the `` elements - `tabTypes` and `tabModes` - all of the tab types and modes, as described below - `tabInfo` - tab info objects for all open tabs - `currentTabInfo` - the tab info object of the current tab - `currentAbout3Pane` - the `window` object showing about:3pane, if the current tab is a `mail3PaneTab` tab - `currentAboutMessage` - the `window` object showing about:message, if the current tab is a `mailMessageTab` tab, or if it is a `mail3PaneTab` tab displaying a message ## Useful methods - `openTab` - takes a tab mode name and an optional object argument, which it passes to `openTab` on the tab mode. - `switchToTab` - switch to the given tab - `closeTab` - closes a given tab, or the current tab - `closeOtherTabs` - closes all closeable tabs except the given tab - `getTabForBrowser` - given a ``, finds the related tab ## Tab types and tab modes Components can register a tab _type_, implementing one or more tab _modes_. These days the distinction between a type and a mode is blurry, and we probably don't need both, but here we are. ### `mail` The primary mail UI: - The `mail3PaneTab` mode, which displays about:3pane in a chrome ``. This is the first tab, that cannot be closed without closing the window. However, more instances can be opened (for example by opening a folder in a new tab), and these can be closed. - The `mailMessageTab` mode, which displays about:message in a chrome ``. As well as the usual properties of a tab, each of these tab modes has a `chromeBrowser` property which points to the top-level `` element contained within. This differs from the `browser` property, which points to the content `` displaying a message within the tab, if there is one. `mail3PaneTab`s have a `folder` property pointing to the currently selected folder, and tabs of both modes have a `message` property pointing to the currently displayed message, if there is one. ### `addressBook` The `addressBookTab` mode displays about:addressbook in a content ``. Only one instance can be opened at a time. ### `calendar` Provides the `calendar` tab mode, the day/week/multiweek/month views, and the `tasks` tab mode, which is the tasks list. There can be only one of each open at a time. Unlike most other tab modes, the calendar and tasks tabs consist of elements in the messenger.xhtml document itself, rather than as a separate document in a `` element. This will change as the calendar UI is rebuilt. ### `calendarItem` This type provides the `calendarEvent` and `calendarTask` tab modes, which are used if calendar item editing happens in a tab rather than a window. ### `chat` The chat UI. Like the calendar modes, the `chat` tab mode has elements that are built-in to messenger.xhtml. ### `glodaFacet` The `glodaFacet` mode displays search results. It has a toolbar that is part of messenger.xhtml and glodaFacetViewWrapper.xhtml displayed in an `