Bootstrap 5 Tab JS (panel switcher + ARIA + keyboard nav + 43 KB infra) vs Native <details name=""> exclusive accordion
MutationObserver. CSS transitions are disabled during the run
so we measure raw JS overhead, not animation time.
Uses bootstrap.Tab — manages .active classes, fires show/shown/hide/hidden events, handles keyboard navigation (arrow keys), ARIA attributes. Requires 8 JS dependency files (43 KB).
Uses <details name=""> — only one open at a time per group, browser closes others automatically. Built-in keyboard support (Enter/Space). Zero initialization, zero framework JS.
| Metric | Bootstrap Tab | Native <details> |
|---|---|---|
| Initialization time (20 groups × 4 tabs) | - | - |
| Switch time (100 cycles × 20 groups × 4 tabs) | - | - |
| DOM mutations (100 cycles × 20 groups × 4 tabs) | - | - |
| Instance memory cost (80 tab instances) | - | - |
|
JS code size
tab.js (10.2 KB) +
base-component (2.8 KB) +
event-handler (9.2 KB) +
selector-engine (4.1 KB) +
data (2.1 KB) +
manipulator (2.3 KB) +
util (9.1 KB) +
config (2.5 KB)
|
- | - |
|
CSS output size
_nav.scss (5.1 KB)
|
- | - |
bootstrap.Tab
<details name="">
.active classes on triggers and panels,
manages aria-selected attributes, handles arrow-key navigation, and fires 4 lifecycle events
per switch. Native <details name=""> provides mutually exclusive panels with
zero initialization — the browser automatically closes sibling details elements
when one opens. Built-in keyboard support (Enter/Space) and accessibility semantics are included.
<!-- Exclusive tab group — only one open at a time -->
<details name="my-tabs" open>
<summary>Home</summary>
<p>Home panel content.</p>
</details>
<details name="my-tabs">
<summary>Profile</summary>
<p>Profile panel content.</p>
</details>
<details name="my-tabs">
<summary>Contact</summary>
<p>Contact panel content.</p>
</details>
<!-- That's it. No JS. No ARIA attributes.
Browser handles exclusivity, keyboard, and semantics. -->