Skip to content

Add missing overflow behaviors to BitPivot (#432)#12535

Merged
msynk merged 3 commits into
bitfoundation:developfrom
msynk:432-blazorui-pivot-overflow
Jul 1, 2026
Merged

Add missing overflow behaviors to BitPivot (#432)#12535
msynk merged 3 commits into
bitfoundation:developfrom
msynk:432-blazorui-pivot-overflow

Conversation

@msynk

@msynk msynk commented Jun 29, 2026

Copy link
Copy Markdown
Member

closes #432

Summary by CodeRabbit

  • New Features

    • Added Pivot overflow support with Menu, Slide, and Scroll modes when tabs don’t fit.
    • Introduced new customization options for next/previous and overflow icons plus configurable aria-labels.
    • Added new demo showcasing overflow (including vertical and RTL variants).
  • Bug Fixes

    • Improved overflow measurements and dynamic updates for more accurate start/end and overflow state.
    • Enhanced accessibility markup and keyboard-friendly overflow/menu behavior.
  • Tests

    • Extended Pivot tests for slide overflow CSS mapping and new overflow button aria-label behavior.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f44681ec-4069-460e-a6d5-6f60ee3060f6

📥 Commits

Reviewing files that changed from the base of the PR and between e211a99 and 53b21a1.

📒 Files selected for processing (1)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor.cs

Walkthrough

Adds Menu and Slide overflow behaviors to BitPivot. The component now wires new client-side overflow measurement and slide-state callbacks, updated Razor markup and styles, new configuration parameters, and demo/test coverage for the overflow UI.

Changes

BitPivot Overflow Behavior

Layer / File(s) Summary
Enum, parameters, and class/style contracts
BitPivotOverflowBehavior.cs, BitPivotClassStyles.cs, BitPivot.razor.cs
Adds Slide and new next/previous/overflow label, icon, and class/style configuration surface.
TypeScript Pivot controller
Scripts/Pivot.ts
Adds the client controller for menu overflow measurement, slide state tracking, manual scrolling, and cleanup.
C# JS interop extensions and component lifecycle
Extensions/JsInterop/PivotJsRuntimeExtensions.cs, BitPivot.razor.cs
Adds JS runtime wrappers, setup/refresh/dispose lifecycle handling, JS-invokable state updates, and overflow interaction helpers.
Razor markup and SCSS styles
BitPivot.razor, BitPivot.scss
Adds the overflow wrapper markup, conditional controls, callout rendering, and matching layout/style rules.
Demo and tests
BitPivotDemo.razor, BitPivotDemo.razor.cs, BitPivotTests.cs
Adds overflow demo examples, updates demo metadata, and extends CSS/ARIA tests.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ResizeObserver
  participant PivotInstance
  participant BitPivot as BitPivot (.NET)
  ResizeObserver->>PivotInstance: resize triggers update()
  PivotInstance->>PivotInstance: updateMenu() / updateSlide()
  PivotInstance->>BitPivot: OnSetOverflowItems(indexes)
  PivotInstance->>BitPivot: OnSetSlideState(hasOverflow, atStart, atEnd)
  BitPivot->>BitPivot: StateHasChanged()
  BitPivot->>PivotInstance: slide(forward)
Loading

Poem

🐇 The tabs were too many, the header said “wheee!”
So menu and slide modes came hopping to be.
With chevrons and callouts, the overflow sings,
And Pivot now dances on rabbit-soft springs.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding missing overflow behaviors to BitPivot.
Linked Issues check ✅ Passed The PR implements both requested overflow modes, menu and slide, for BitPivot as described in #432.
Out of Scope Changes check ✅ Passed The added tests, demo updates, styles, and JS interop all support the BitPivot overflow work and appear in scope.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Navs/Pivot/BitPivotTests.cs (1)

61-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a test for the overflow button label.

This still only asserts a regular pivot item’s aria-label. The new Menu branch adds a separate icon-only overflow trigger, so a regression in OverflowAriaLabel wiring would pass this suite.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Navs/Pivot/BitPivotTests.cs`
around lines 61 - 72, Add a test for the overflow button’s aria-label, since
BitPivotAriaLabelTest only covers regular pivot items. Update BitPivotTests to
render a BitPivot with overflow enabled and assert the overflow trigger button
uses the OverflowAriaLabel value, so regressions in BitPivot/OverflowAriaLabel
wiring are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor`:
- Around line 33-40: The overflow trigger in BitPivot is exposing
OverflowAriaLabel directly on an icon-only button, so it needs a built-in
accessible fallback instead of defaulting to null. Update the BitPivot
component’s overflow button markup and the OverflowAriaLabel parameter handling
so the control uses a sensible default label when no override is provided, while
still allowing consumers to supply their own value.
- Around line 18-24: The icon-only slide buttons in BitPivot.razor are unnamed
controls, so add accessible labels to both the previous and next buttons. Update
the button markup around the Slide(false) and Slide(true) handlers to include
localized aria-label text, and add matching public parameters or resource-backed
values if the component doesn’t already expose them. Keep the labels symmetric
and ensure the existing prevIcon/nextIcon usage remains unchanged.

In `@src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor.cs`:
- Around line 87-124: Add accessible names for the icon-only overflow buttons in
BitPivot so slide navigation and menu controls are labeled by default. Update
BitPivot.razor and the BitPivot component contract to introduce/fallback
aria-label parameters for the previous and next slide buttons, and make
OverflowAriaLabel non-null-safe by providing a default label when none is
supplied. Wire these labels into the existing icon-only button markup so the new
overflow modes are accessible without requiring consumers to set every label
manually.
- Around line 241-293: The Pivot JS instance is only reinitialized when
OverflowBehavior changes, but OnAfterRenderAsync also passes the current RTL
state into BitPivotSetup, so switching Dir at runtime leaves the existing
PivotInstance using stale direction logic. Update the teardown/recreate
condition in OnAfterRenderAsync to also detect changes in the effective RTL
state (the Dir is BitDir.Rtl value), and when that changes dispose the current
JS setup and rebuild it just like a behavior change. Keep the refresh path only
for cases where both behavior and RTL state are unchanged.

In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor.cs`:
- Around line 1560-1589: The `example15RazorCode` sample for `BitPivot` does not
reproduce overflow because it omits the narrow-width wrapper used by the live
demo. Update the snippet to include the same constrained container styling
around each `BitPivot` example so `OverflowBehavior.Menu`, `Slide`, and `Scroll`
actually trigger in a typical copy/paste scenario and match the demo behavior.

---

Nitpick comments:
In
`@src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Navs/Pivot/BitPivotTests.cs`:
- Around line 61-72: Add a test for the overflow button’s aria-label, since
BitPivotAriaLabelTest only covers regular pivot items. Update BitPivotTests to
render a BitPivot with overflow enabled and assert the overflow trigger button
uses the OverflowAriaLabel value, so regressions in BitPivot/OverflowAriaLabel
wiring are caught.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c5341a70-bc3a-469f-be1e-9b6c1a17cfca

📥 Commits

Reviewing files that changed from the base of the PR and between 9c34dfb and a0d6ae9.

📒 Files selected for processing (10)
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.scss
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivotClassStyles.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivotOverflowBehavior.cs
  • src/BlazorUI/Bit.BlazorUI/Extensions/JsInterop/PivotJsRuntimeExtensions.cs
  • src/BlazorUI/Bit.BlazorUI/Scripts/Pivot.ts
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor.cs
  • src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Navs/Pivot/BitPivotTests.cs

Comment thread src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor
Comment thread src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor
Comment thread src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor.cs
Comment thread src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor.cs
@msynk

msynk commented Jun 29, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

@msynk Re-reviewing the PR now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor.cs`:
- Around line 82-85: The Pivot demo property descriptions for NextIconName and
PrevIconName currently document only the horizontal fallback icons, but
BitPivot’s runtime behavior also switches to vertical defaults. Update the
descriptions in BitPivotDemo.razor.cs so they mention both cases:
ChevronRight/ChevronLeft for horizontal pivots and ChevronDown/ChevronUp for
vertical pivots, matching the logic in BitPivot.razor.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c7595f60-512b-431f-a90d-2660582bb96c

📥 Commits

Reviewing files that changed from the base of the PR and between a0d6ae9 and e211a99.

📒 Files selected for processing (8)
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor.cs
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.scss
  • src/BlazorUI/Bit.BlazorUI/Extensions/JsInterop/PivotJsRuntimeExtensions.cs
  • src/BlazorUI/Bit.BlazorUI/Scripts/Pivot.ts
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor.cs
  • src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Navs/Pivot/BitPivotTests.cs
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/BlazorUI/Bit.BlazorUI/Extensions/JsInterop/PivotJsRuntimeExtensions.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor.cs

@msynk

msynk commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai re-review

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

@msynk Re-reviewing the PR now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@msynk msynk merged commit 4865dfe into bitfoundation:develop Jul 1, 2026
3 checks passed
@msynk msynk deleted the 432-blazorui-pivot-overflow branch July 1, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BitPivot overflow behavior

1 participant