fix(tabs): fix hover and active indicator sizing across tab - #125
Conversation
There was a problem hiding this comment.
📋 Review Summary
This pull request refactors link handling in md-tab (tabs/tab.js). Instead of swapping the root .button element between <button>/<div> and <a>, it renders a separate <a class="link"> overlay inside .button, aligning the pattern with other components such as md-button and md-carousel-item.
🔍 General Feedback
- The change simplifies the DOM template by avoiding conditionally swapped parent wrapper elements and preserves child component instances (ripple, elevation, focus ring) across link and non-link states.
- Bypassing
handleContentClickwhenthis.hrefis truthy ensures native link navigation semantics (such as middle-click, command-click, and context menus) are not suppressed.
📊 Token Usage & Cost Efficiency
| Metric | Value |
|---|---|
| Input Tokens (uncached) | 11,654 |
| Input Tokens (cached) | 340,128 (⚡ 96.7% cached) |
| Output Tokens | 396 |
| Total Session Tokens | 352,230 |
| Cost (uncached input) | $0.0087 |
| Cost (cached input) | $0.0255 |
| Cost (output) | $0.0015 |
| Estimated Total Cost | $0.0357 |
Gemini 3.8 Flash: introductory rate $0.75/$3.75 per 1M applied; reverts to $1.5/$7.5 after 2026-12-31.
Gemini 3.8 Flash: standard tier; batch and flex are half again, priority is higher.
Cache reads are priced here, but context-cache STORAGE, where the model charges for it separately per token-hour, is not included, so the figure can run slightly low.
| if (this.href) { | ||
| return | ||
| } |
There was a problem hiding this comment.
🟡 When this.href is present, returning early from handleContentClick means clicking the tab content will not dispatch a click event on the host element (this.click()), nor will activateTab in <md-tabs> be triggered (which listens to @click on the slot). Consequently, clicking an anchor-based tab will navigate to the URL but fail to update activeTabIndex or active states in <md-tabs> when SPA routing or intra-page navigation is used without a full page refresh. Consider allowing the host click or ensuring md-tabs can capture the tab activation.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
material | 6d85a24 | Commit Preview URL Branch Preview URL |
Sep 03 2026, 03:30 PM |
Problem
Commit
8fbcf33addedhrefsupport to tabs by wrapping content with.button(aordiv) styled withdisplay: inline-flex; position: relative;. This introduced a regression:position: relativehijacked the containing block for<md-ripple>,.button::before, and the full-width.indicatorfrom:hostto.button.display: inline-flexcaused.buttonto shrink-wrap around only the text/icon contents, making the hover background and secondary indicator show only on the text area instead of the whole tab.Solution
.button { display: inline-flex; position: relative; ... }so.buttonremainsposition: static(as originally designed), restoring:hostas the containing block..linkoverlay pattern (nav/item.js,nav/tab.js,buttons/fab.js):<a class="link" id="link" ...></a>covering the full tab whenhrefis present.handleContentClickto return early whenhrefis present so link navigation is not interrupted.handleKeydownto triggera.linkon Enter or Space.