Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Sep 19, 2025

closes #11421

Summary by CodeRabbit

  • New Features

    • Pivot position now supports Start/End options aligned with LTR/RTL layouts.
  • Refactor

    • Renamed Pivot position options from Left/Right to Start/End for direction-agnostic behavior.
  • Style

    • Updated styling to use logical start/end positioning with refined indicator transitions.
  • Documentation

    • Demos updated to showcase Start/End positions, including expanded RTL examples and descriptions.
  • Tests

    • Test suites updated to validate Start/End positioning and corresponding visual behavior.

@coderabbitai
Copy link

coderabbitai bot commented Sep 19, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Enum members Left/Right are renamed to Start/End for BitPivot, with corresponding CSS class changes and RTL-aware logical properties in styles. Tests and demos are updated to use Start/End. A minor whitespace edit appears in BitPivot.razor. Demo examples expand to showcase Start/End, including RTL scenarios.

Changes

Cohort / File(s) Summary
Public API: Pivot Position
src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivotPosition.cs
Renamed enum members: Left → Start; Right → End. Updated XML docs to describe RTL/LTR semantics; punctuation tweaks for Top/Bottom.
Component Logic: CSS Mapping
src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor.cs
Updated switch mapping to use Start/End; CSS classes changed from bit-pvt-lft/rgt to bit-pvt-sta/end.
Styles: Pivot SCSS
src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.scss
Renamed classes to .bit-pvt-sta/.bit-pvt-end; replaced left/right with inset-inline-start/end; added state-specific ::before rules and hover transition updates; minor declaration reordering.
Tests: Pivot Position
src/BlazorUI/Bit.BlazorUI.Tests/Components/Navs/Pivot/BitPivotTests.cs
Updated tests to use Start/End and expect bit-pvt-sta/end classes; DataRow inputs and assertions adjusted.
Demo: Razor examples
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor
Replaced Left/Right with Start/End across demos; expanded and reorganized RTL sections; markup simplifications and new Start/End showcase blocks.
Demo: Code-behind
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor.cs
Updated enum option metadata and descriptions for Start/End; added RTL Start/End examples; minor content adjustments.
Markup: Component View (whitespace)
src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor
Removed a blank line; no functional change.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I hopped from Left to Start, then Right to End,
Inline winds guide the tabs I tend.
RTL or LTR, I know the bend—
A pivot pirouette around the trend.
bit-pvt-sta to bit-pvt-end—hippity blend! 🐇✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Fix and improve position feature of BitPivot (#11421)" succinctly describes the primary intent to correct and enhance BitPivot positioning and references the related issue; it is concise, on-topic, and communicates the main change to reviewers at a glance.
Linked Issues Check ✅ Passed The changes in the summary directly address the linked issue #11421 by converting Left/Right to logical Start/End semantics across the enum, component code, CSS class mappings, and tests, and by replacing physical left/right positioning with inset-inline-start/inset-inline-end for the indicator; demo and test updates that exercise RTL scenarios are also included, so the PR implements the intended fix for corrupted horizontal positions and RTL behavior.
Out of Scope Changes Check ✅ Passed Reviewed changes appear to be in-scope for the pivot position fix: the enum rename, CSS selector and positioning updates, tests, and demo adjustments all relate to position semantics; the only non-functional modification noted is a whitespace removal in BitPivot.razor. The enum rename is a deliberate public API change tied to the position semantics (Start/End) rather than an unrelated modification, but it constitutes a breaking change that should be documented. No unrelated feature or component changes were observed in the provided summaries.

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.scss (1)

88-95: Limit hover expansion to Top/Bottom to avoid Start/End indicator distortion

.bit-pvt-lnk .bit-pvti-sel:hover::before { inset-inline: 0 } expands the horizontal indicator correctly for Top/Bottom, but when Position is Start/End (vertical indicator), this rule stretches the indicator across the full width and conflicts with the vertical animation block below.

Scope the hover expansion to Top/Bottom only and remove the generic rule.

Apply:

 .bit-pvt-lnk {
   .bit-pvti-sel {
     @media(hover:hover) {
       &:hover {
-        &::before {
-            inset-inline: 0;
-        }
+        // moved to Top/Bottom scope to avoid Start/End conflicts
       }
     }
   }
 }
+
+// Only Top/Bottom should expand inline on hover
+.bit-pvt-top,
+.bit-pvt-btm {
+  &.bit-pvt-lnk, // headerType: Link
+  .bit-pvt-lnk { // in case classes are combined in different orders
+    .bit-pvti-sel {
+      @media(hover:hover) {
+        &:hover {
+          &::before { inset-inline: 0; }
+        }
+      }
+    }
+  }
+}
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor (1)

462-497: Fix leftover Left/Right usages in Pivot Position demo

  • Replace BitPivotPosition.Left/Right in src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor.cs (example10RazorCode defined ~line 812; occurrences at ~lines 881 and 915) and update the demo page (src/.../BitPivotDemo.razor, RazorCode at ~line 387) and any accompanying doc/description strings to use BitPivotPosition.Start/End and "Start"/"End" wording.
🧹 Nitpick comments (6)
src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.scss (1)

56-70: Optional: prefer gap/logical margins for vertical layout spacing

When Position is Start/End, items stack vertically but .bit-pvti still uses margin-right. Consider using gap on .bit-pvt-hct or margin-block-end on items to achieve consistent spacing in vertical layout.

Also applies to: 226-246

src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivotPosition.cs (1)

16-24: Add Left/Right enum aliases marked Obsolete to preserve source/binary compatibility

Renaming public enum members is a breaking change. You can keep compatibility by adding aliases and marking them [Obsolete] while keeping the new Start/End as canonical.

Apply:

 public enum BitPivotPosition
 {
   /// <summary>
   /// Display header at the top.
   /// </summary>
   Top,

   /// <summary>
   /// Display header at the bottom.
   /// </summary>
   Bottom,

   /// <summary>
   /// Display header at the start (Left for LTR and Right for RTL).
   /// </summary>
   Start,

   /// <summary>
   /// Display header at the end (Right for LTR and Left for RTL).
   /// </summary>
   End,
+
+  /// <summary>
+  /// Obsolete: use Start (Left for LTR and Right for RTL).
+  /// </summary>
+  [Obsolete("BitPivotPosition.Left is obsolete. Use BitPivotPosition.Start instead.")]
+  Left = Start,
+
+  /// <summary>
+  /// Obsolete: use End (Right for LTR and Left for RTL).
+  /// </summary>
+  [Obsolete("BitPivotPosition.Right is obsolete. Use BitPivotPosition.End instead.")]
+  Right = End,
 }
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor.cs (1)

423-431: Docs OK for Start/End; update earlier sample that still shows Left/Right

Enum descriptions here are correct. The earlier example10RazorCode still demonstrates BitPivotPosition.Left/Right, which no longer exist and can confuse users. Please update that sample to Start/End.

Suggested replacement for the two blocks in example10:

private readonly string example10RazorCode = @"
<BitPivot Position=""BitPivotPosition.Top""> ... </BitPivot>

<BitPivot Position=""BitPivotPosition.Bottom""> ... </BitPivot>

<BitPivot Position=""BitPivotPosition.Start""> ... </BitPivot>

<BitPivot Position=""BitPivotPosition.End""> ... </BitPivot>";
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor (3)

680-697: Add lang for RTL a11y.

Mark Persian content language for screen readers.

Apply:

-        <div class="box">
+        <div class="box" lang="fa">

699-724: RTL + Start: add lang and align OverflowBehavior with first RTL sample.

Improves a11y and keeps behavior consistent when headers overflow.

Apply:

-        <div class="box">
+        <div class="box" lang="fa">
@@
-            <BitPivot Dir="BitDir.Rtl" Position="BitPivotPosition.Start">
+            <BitPivot Dir="BitDir.Rtl" Position="BitPivotPosition.Start" OverflowBehavior="@BitPivotOverflowBehavior.Scroll">

726-751: RTL + End: mirror the same tweaks.

Add lang and OverflowBehavior for parity with other RTL blocks.

Apply:

-        <div class="box">
+        <div class="box" lang="fa">
@@
-            <BitPivot Dir="BitDir.Rtl" Position="BitPivotPosition.End">
+            <BitPivot Dir="BitDir.Rtl" Position="BitPivotPosition.End" OverflowBehavior="@BitPivotOverflowBehavior.Scroll">
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 207e586 and 9edec28.

📒 Files selected for processing (7)
  • src/BlazorUI/Bit.BlazorUI.Tests/Components/Navs/Pivot/BitPivotTests.cs (2 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor (0 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor.cs (1 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.scss (4 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivotPosition.cs (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor (3 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor.cs (2 hunks)
💤 Files with no reviewable changes (1)
  • src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build and test
🔇 Additional comments (3)
src/BlazorUI/Bit.BlazorUI.Tests/Components/Navs/Pivot/BitPivotTests.cs (1)

71-76: LGTM: tests updated to Start/End and class mappings

Coverage for Top/Bottom/Start/End CSS class selection looks correct and aligned with the new enum values and SCSS class names.

Also applies to: 84-96

src/BlazorUI/Bit.BlazorUI/Components/Navs/Pivot/BitPivot.razor.cs (1)

122-129: LGTM: Position mapping updated to sta/end — verify no stale lft/rgt references

Start -> bit-pvt-sta and End -> bit-pvt-end align with SCSS; default remains Top. rg returned no output; re-run a repo-wide search for 'bit-pvt-(lft|rgt)' or explicitly check 'bit-pvt-lft' and 'bit-pvt-rgt' to confirm no stale mappings remain.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/Pivot/BitPivotDemo.razor (1)

499-535: End mapping LGTM.

Consistent with logical inline-end semantics. Same repo-wide Left/Right sweep recommended.

Use the same script in the prior comment.

@msynk msynk merged commit 1fce940 into bitfoundation:develop Sep 19, 2025
3 checks passed
@msynk msynk deleted the 11421-blazorui-pivot-position-issues branch September 19, 2025 10:53
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.

The horizontal positions of the BitPivot got corrupted after the latest improvements

1 participant