Skip to content

Complete the portal shadcn primitive set - #8

Merged
rqms40 merged 1 commit into
mainfrom
fm/gridgo-web-shadcn-complete
Aug 10, 2026
Merged

rqms40 merged 1 commit into
mainfrom
fm/gridgo-web-shadcn-complete

Conversation

@rqms40

@rqms40 rqms40 commented Aug 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add the six shadcn primitives with concrete portal call sites: Alert Dialog, Sidebar, Progress, Chart, Breadcrumb, and Toggle Group.
  • Migrate AppShell navigation to Sidebar and the existing Dropdown Menu while preserving ROLE_NAV as the only role-to-navigation source.
  • Replace destructive confirmations, schedule and claim selectors, capacity display, finance aggregates, and nested workspace links with the new primitives.
  • Keep GRIDGO tokens and product components intact, add the global 44px target floor for the new controls, and document the primitive audit in AGENTS.md.

Audit decisions

Accepted: Alert Dialog for irreversible actions; Sidebar for the authenticated shell; Progress for supplier capacity; Chart for finance payment-method mix; Breadcrumb for nested job and QA workspaces; Toggle Group for schedule mode and claim-hold choices.

Rejected: Avatar because there is no photo identity surface; Accordion/Collapsible because no disclosure hierarchy exists; Slider because capacity and money need exact values; Sonner because the Base UI toast manager and root Toaster already cover notifications.

Critique pass

Removed the inert Notifications button from AppShell because it had no behavior or endpoint and did not earn its place.

Validation

  • npm run typecheck
  • npm run lint
  • npm test — 97 tests passed
  • npm run build
  • Browser matrix — 44/44 role navigation pages passed across light and dark, with stable URLs, real content, and zero console errors
  • Keyboard pass — 4/4 scenarios passed for visible navigation focus, nested breadcrumbs, Alert Dialog focus trap/restore, and mobile Sidebar focus trap/restore
  • Yellow budget audit — every touched page surface stayed at one or fewer yellow controls; dialog footer submits remain bounded panel actions

Summary by CodeRabbit

  • New Features

    • Added interactive payment-method charts on the finance page.
    • Added capacity progress indicators with over-capacity messaging.
    • Added day/week toggle controls to scheduling views.
    • Added responsive sidebar navigation and breadcrumb support.
    • Added reusable toggle, progress, chart, and confirmation dialog components.
    • Added clearer claim hold/release details, including actors, timestamps, and confirmation flows.
  • Usability

    • Improved confirmation dialogs across administrative and supplier workflows.
    • Increased minimum touch-target sizes for key controls.
    • Removed outdated navigation elements from QA details.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change adds shared Base UI and Recharts primitives, replaces custom shell and confirmation controls, adds payment and capacity visualizations, standardizes toggle controls, and applies related layout and accessibility updates.

Changes

UI platform integration

Layer / File(s) Summary
Shared UI primitives and contracts
src/components/ui/*, src/hooks/use-mobile.ts, package.json, AGENTS.md, src/app/globals.css
Added shared AlertDialog, breadcrumb, chart, progress, sidebar, toggle, toggle-group, and mobile viewport components. Added the recharts dependency and primitive audit records.
Shared shell navigation
src/components/shell/AppShell.tsx
Replaced custom navigation and account state with shared sidebar, breadcrumb, and dropdown-menu components.
Confirmation and control migrations
src/app/admin/roles/page.tsx, src/app/admin/verification/page.tsx, src/app/ops/claims/page.tsx, src/app/ops/schedule/page.tsx, src/app/supplier/catalogue/page.tsx, src/app/supplier/jobs/[id]/page.tsx, src/app/supplier/schedule/page.tsx
Migrated confirmations to AlertDialog. Replaced custom day/week and claim-action controls with ToggleGroup components.
Page data displays and presentation updates
src/app/admin/finance/page.tsx, src/app/supplier/capacity/page.tsx, src/app/ops/qa/[id]/page.tsx
Added payment-method order charts and supplier capacity utilisation displays. Applied presentation-only formatting updates.
Estimated code review effort: 4 (Complex) ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AppShell
  participant Sidebar
  participant Page
  participant AlertDialog
  User->>AppShell: open application route
  AppShell->>Sidebar: render navigation and active item
  User->>Page: select page action
  Page->>AlertDialog: open confirmation workflow
  User->>AlertDialog: confirm or cancel action
  AlertDialog-->>Page: return confirmation result
Loading

Possibly related PRs

  • rqms40/gridgo-web#4: Modifies the Operations claims and schedule pages, which this change also updates with shared AlertDialog and ToggleGroup components.
🚥 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
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: completing the shadcn primitive set and integrating the new portal-based primitives.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fm/gridgo-web-shadcn-complete

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: 12

Caution

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

⚠️ Outside diff range comments (2)
src/app/admin/verification/page.tsx (1)

451-579: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Keep verification reason entry in Dialog.

Lines 451-579 use AlertDialog for user verification, service activation, and suspension while collecting a reason. The verification and activation paths are not destructive confirmations. Use Dialog for these input workflows. If suspension needs an extra confirmation, show AlertDialog after the reason form is complete.

As per coding guidelines, use Dialog for modal input tasks, and AlertDialog for destructive or irreversible confirmations.

🤖 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/app/admin/verification/page.tsx` around lines 451 - 579, The user
verification and service activation reason forms should use Dialog rather than
AlertDialog, since they are modal input workflows rather than destructive
confirmations. Update the dialogs around the user verification and service
action handlers, preserving their existing fields, validation, error display,
and submit behavior; retain AlertDialog only for suspension’s final destructive
confirmation after the reason form is completed.

Source: Coding guidelines

src/app/admin/roles/page.tsx (1)

227-337: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Use Dialog for the role-editing form.

Lines 227-337 collect a new role, an audit reason, and sometimes a typed confirmation. This is a modal input task. Keep this workflow in Dialog, or collect the inputs in Dialog and show AlertDialog only for the final high-risk confirmation.

As per coding guidelines, use Dialog for modal input tasks, and AlertDialog for destructive or irreversible confirmations.

🤖 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/app/admin/roles/page.tsx` around lines 227 - 337, Replace the
role-editing form’s outer AlertDialog with Dialog, preserving its open-state
cleanup, fields, validation, error display, and submit behavior around the
existing target, nextRole, reason, and applyRole symbols. If high-risk changes
require a destructive confirmation, move only that final confirmation into a
separate AlertDialog rather than using AlertDialog for the input form.

Source: Coding guidelines

🧹 Nitpick comments (5)
src/components/ui/chart.tsx (1)

82-112: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Constrain the injected color values in ChartStyle.

color and theme[...] flow unescaped into a <style> element. Today every ChartConfig is authored in code, so the risk is low. If a future chart derives a series color from an API response, an attacker-controlled string can close the declaration block and inject arbitrary CSS rules.

Add a format guard so only recognised color syntax reaches the stylesheet. This also clears the static analysis findings on Lines 92-93.

🔒 Proposed hardening
+const SAFE_COLOR = /^[\w\s.,%#()/-]+$/;
+
 const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
   const colorConfig = Object.entries(config).filter(
     ([, config]) => config.theme ?? config.color,
   );
@@
     const color =
       itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ?? itemConfig.color;
-    return color ? `  --color-${key}: ${color};` : null;
+    return color && SAFE_COLOR.test(color) ? `  --color-${key}: ${color};` : null;
   })
🤖 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/components/ui/chart.tsx` around lines 82 - 112, Update ChartStyle to
validate every color from itemConfig.color and itemConfig.theme before
interpolating it into the generated stylesheet. Allow only recognized color
syntax, omit invalid values, and preserve the existing custom-property
generation for valid colors.

Source: Linters/SAST tools

src/hooks/use-mobile.ts (1)

8-16: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Read mql.matches instead of window.innerWidth.

Line 9 builds the query from MOBILE_BREAKPOINT - 1, and Lines 11 and 14 then recompute the same decision from window.innerWidth. window.innerWidth includes the scrollbar width; the media query does not. Around the 768px boundary the two can disagree, so the listener can store a value that contradicts the query that fired it.

Use the MediaQueryList as the single source of truth.

♻️ Proposed refactor
   React.useEffect(() => {
     const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
-    const onChange = () => {
-      setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
-    };
+    const onChange = () => {
+      setIsMobile(mql.matches);
+    };
     mql.addEventListener("change", onChange);
-    setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
+    setIsMobile(mql.matches);
     return () => mql.removeEventListener("change", onChange);
   }, []);
🤖 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/hooks/use-mobile.ts` around lines 8 - 16, Update the useEffect callback
and its initial state assignment in the mobile detection hook to use mql.matches
instead of window.innerWidth comparisons. Keep the MediaQueryList created from
MOBILE_BREAKPOINT - 1 as the single source of truth for both change events and
initialization.
src/components/shell/AppShell.tsx (1)

161-168: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Sign out now appears twice in the shell.

Line 163 places a Sign out control in the sidebar footer. Line 229 places another one in the header dropdown. Both call signOut().

Two entry points for the same session-ending action add no capability and duplicate the handler. Keep one. The header dropdown reaches every user, including when the sidebar is collapsed to icons or closed on mobile.

Also applies to: 212-235

🤖 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/components/shell/AppShell.tsx` around lines 161 - 168, Remove the
sidebar-footer Sign out control from the SidebarMenu and retain the header
dropdown Sign out action near the existing header menu. Preserve the remaining
sidebar items and the header action’s signOut() behavior.
src/components/ui/sidebar.tsx (2)

70-85: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

The sidebar cookie is written but never read.

setOpen writes sidebar_state on every toggle (Line 82). No code in this file reads that cookie. Initial state comes only from defaultOpen, which defaults to true at Line 53. src/components/shell/AppShell.tsx Line 182 renders <SidebarProvider> with no defaultOpen, so the collapsed state resets on every full page load.

Either read the cookie in the server layout and pass it as defaultOpen, or remove the cookie write.

🤖 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/components/ui/sidebar.tsx` around lines 70 - 85, Update the sidebar
initialization flow around SidebarProvider and setOpen so the persisted sidebar
cookie is actually read and used to derive defaultOpen on full page loads,
passing that value from the server layout such as AppShell into SidebarProvider.
Preserve setOpen’s cookie persistence and ensure the fallback remains the
existing default when no valid cookie is present.

584-594: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Math.random() in the state initializer causes a hydration mismatch.

SidebarMenuSkeleton is a client component in the App Router. The server render and the client hydration produce different --skeleton-width values, so React reports a hydration mismatch.

No screen uses this component yet, so the impact is latent. Set the width after mount instead.

♻️ Proposed fix
-  // Random width between 50 to 90%.
-  const [width] = React.useState(() => {
-    return `${Math.floor(Math.random() * 40) + 50}%`;
-  });
+  // Random width between 50 to 90%, assigned after mount to keep SSR output stable.
+  const [width, setWidth] = React.useState("70%");
+  React.useEffect(() => {
+    setWidth(`${Math.floor(Math.random() * 40) + 50}%`);
+  }, []);
🤖 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/components/ui/sidebar.tsx` around lines 584 - 594, Update
SidebarMenuSkeleton so its initial render uses a deterministic width, then
generate and apply the randomized 50–90% width in a post-mount effect. Preserve
the existing width styling and avoid calling Math.random() during the state
initializer to prevent server/client hydration differences.
🤖 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/app/admin/finance/page.tsx`:
- Line 218: Update the paymentMethods flow around summariseMethods so orders
with missing paymentMethod values do not cause the chart to render when no
actual methods exist. Filter those entries before the chart-versus-EmptyState
decision, preserving the existing EmptyState behavior for orders lacking
recorded payment methods.
- Around line 325-330: Move the accessible chart label from ChartContainer to
the inner BarChart in the payment-method chart, using aria-label or
aria-labelledby="method-heading". Keep accessibilityLayer enabled so the label
is applied to the SVG’s accessible role and keyboard target.

In `@src/app/globals.css`:
- Around line 548-554: Update the global selector list for the 44px touch-target
floor to include [data-slot="toggle-group-item"] alongside the existing control
selectors. Keep the current min-height and min-width declarations unchanged so
toggle-group items used by the schedule and claim-choice controls meet the 44×44
requirement.
- Around line 531-532: Add a blank line immediately before the multiline
box-shadow declaration in the affected stylesheet rule to satisfy Stylelint’s
declaration-empty-line-before requirement, without changing the declaration’s
values.

In `@src/app/ops/claims/page.tsx`:
- Around line 535-589: Separate the reason-entry flow from the confirmation
flow: replace the input-bearing AlertDialog around submitDialog with a Dialog
that collects and validates reason, then open a distinct AlertDialog only when
confirming the hold or release action. Update the dialog state and submit
handlers so the final action proceeds only after the reason is valid, while
preserving the existing hold/release labels, errors, loading state, and
cancellation behavior.

In `@src/app/supplier/capacity/page.tsx`:
- Around line 13-19: Update the error handling in the supplier capacity page to
use the API client’s isApiError(err) type guard instead of err instanceof
ApiError, and identify forbidden responses through the error’s kind or code
rather than status. Adjust the imports accordingly and preserve the existing
forbidden-state behavior.

In `@src/components/shell/AppShell.tsx`:
- Around line 156-160: Remove the persistent user email rendering from the
SidebarFooter while retaining the user name display. Keep the existing account
dropdown behavior around the relevant account-menu symbol unchanged so the email
remains available on demand.

In `@src/components/ui/breadcrumb.tsx`:
- Around line 42-56: Update BreadcrumbLink to provide a minimum 44px touch
target, preferably by adding appropriate vertical padding or by extending the
existing global 44px floor rule to [data-slot="breadcrumb-link"]. Preserve its
current hover styling and ensure the control retains the global visible
:focus-visible 2px outline treatment.

In `@src/components/ui/sidebar.tsx`:
- Around line 247-271: Ensure SidebarTrigger provides a minimum 44×44 touch
target while preserving its existing accessible name and focus treatment. Prefer
updating the shared global touch-target rule to include the
data-slot="sidebar-trigger" selector, or equivalently change SidebarTrigger’s
button sizing from icon-sm to a 44px-compatible size; do not alter its toggle
behavior.

In `@src/components/ui/toggle-group.tsx`:
- Around line 43-45: Update the toggle group styling in the component rendering
the shown className so the runtime spacing value is defined as a calculated CSS
length using the spacing variable and configured multiplier, then reference it
with the gap custom-property utility instead of the current spacing function.
Also pass the existing orientation value to ToggleGroupPrimitive via its
orientation prop, while retaining the data-orientation styling behavior.
- Around line 23-53: Update ToggleGroup to explicitly forward the orientation
prop to ToggleGroupPrimitive so its data-orientation attribute is applied, and
replace the data-vertical layout selector with selectors targeting
data-orientation="vertical" for the container and related item styles. Preserve
the existing horizontal behavior and context values.

In `@src/components/ui/toggle.tsx`:
- Around line 8-9: Update the toggleVariants class definition to remove
outline-none and the focus-visible ring utilities, allowing the global 2px
foreground outline focus treatment to apply. Preserve the remaining toggle
styling unchanged.

---

Outside diff comments:
In `@src/app/admin/roles/page.tsx`:
- Around line 227-337: Replace the role-editing form’s outer AlertDialog with
Dialog, preserving its open-state cleanup, fields, validation, error display,
and submit behavior around the existing target, nextRole, reason, and applyRole
symbols. If high-risk changes require a destructive confirmation, move only that
final confirmation into a separate AlertDialog rather than using AlertDialog for
the input form.

In `@src/app/admin/verification/page.tsx`:
- Around line 451-579: The user verification and service activation reason forms
should use Dialog rather than AlertDialog, since they are modal input workflows
rather than destructive confirmations. Update the dialogs around the user
verification and service action handlers, preserving their existing fields,
validation, error display, and submit behavior; retain AlertDialog only for
suspension’s final destructive confirmation after the reason form is completed.

---

Nitpick comments:
In `@src/components/shell/AppShell.tsx`:
- Around line 161-168: Remove the sidebar-footer Sign out control from the
SidebarMenu and retain the header dropdown Sign out action near the existing
header menu. Preserve the remaining sidebar items and the header action’s
signOut() behavior.

In `@src/components/ui/chart.tsx`:
- Around line 82-112: Update ChartStyle to validate every color from
itemConfig.color and itemConfig.theme before interpolating it into the generated
stylesheet. Allow only recognized color syntax, omit invalid values, and
preserve the existing custom-property generation for valid colors.

In `@src/components/ui/sidebar.tsx`:
- Around line 70-85: Update the sidebar initialization flow around
SidebarProvider and setOpen so the persisted sidebar cookie is actually read and
used to derive defaultOpen on full page loads, passing that value from the
server layout such as AppShell into SidebarProvider. Preserve setOpen’s cookie
persistence and ensure the fallback remains the existing default when no valid
cookie is present.
- Around line 584-594: Update SidebarMenuSkeleton so its initial render uses a
deterministic width, then generate and apply the randomized 50–90% width in a
post-mount effect. Preserve the existing width styling and avoid calling
Math.random() during the state initializer to prevent server/client hydration
differences.

In `@src/hooks/use-mobile.ts`:
- Around line 8-16: Update the useEffect callback and its initial state
assignment in the mobile detection hook to use mql.matches instead of
window.innerWidth comparisons. Keep the MediaQueryList created from
MOBILE_BREAKPOINT - 1 as the single source of truth for both change events and
initialization.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b95d6ef7-81ef-4621-8ef0-db1648b44fd5

📥 Commits

Reviewing files that changed from the base of the PR and between 928b5cf and 4468686.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (22)
  • AGENTS.md
  • package.json
  • src/app/admin/finance/page.tsx
  • src/app/admin/roles/page.tsx
  • src/app/admin/verification/page.tsx
  • src/app/globals.css
  • src/app/ops/claims/page.tsx
  • src/app/ops/qa/[id]/page.tsx
  • src/app/ops/schedule/page.tsx
  • src/app/supplier/capacity/page.tsx
  • src/app/supplier/catalogue/page.tsx
  • src/app/supplier/jobs/[id]/page.tsx
  • src/app/supplier/schedule/page.tsx
  • src/components/shell/AppShell.tsx
  • src/components/ui/alert-dialog.tsx
  • src/components/ui/breadcrumb.tsx
  • src/components/ui/chart.tsx
  • src/components/ui/progress.tsx
  • src/components/ui/sidebar.tsx
  • src/components/ui/toggle-group.tsx
  • src/components/ui/toggle.tsx
  • src/hooks/use-mobile.ts

const released = formatFigure(rollup.payoutReleased);
const codCollected = formatFigure(rollup.codCollected);
const codOutstanding = formatFigure(rollup.codOutstanding);
const paymentMethods = summariseMethods(orders);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Exclude missing methods from the chart decision.

At Line 218, summariseMethods(orders) adds a none row when paymentMethod is null. If all orders lack a payment method, the page renders a chart instead of the EmptyState at Lines 319-323. Filter missing methods before rendering, or define none as an intentional “Not recorded” category and update the copy.

Proposed fix
-  const paymentMethods = summariseMethods(orders);
+  const paymentMethods = summariseMethods(orders).filter(
+    ({ method }) => method !== "none",
+  );

Also applies to: 319-323

🤖 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/app/admin/finance/page.tsx` at line 218, Update the paymentMethods flow
around summariseMethods so orders with missing paymentMethod values do not cause
the chart to render when no actual methods exist. Filter those entries before
the chart-versus-EmptyState decision, preserving the existing EmptyState
behavior for orders lacking recorded payment methods.

Comment on lines +325 to +330
<ChartContainer
config={paymentMethodChartConfig}
className="h-72 w-full"
aria-label="Order value by payment method"
>
<BarChart data={paymentMethods} accessibilityLayer>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -e

printf '%s\n' '--- target file ---'
sed -n '280,360p' src/app/admin/finance/page.tsx

printf '%s\n' '--- chart-related definitions and usage ---'
rg -n -C 4 'function ChartContainer|const ChartContainer|ChartContainer|accessibilityLayer|aria-label|aria-labelledby' src package.json pnpm-lock.yaml yarn.lock package-lock.json 2>/dev/null | head -n 300

Repository: rqms40/gridgo-web

Length of output: 22497


🏁 Script executed:

#!/bin/bash
set -e

printf '%s\n' '--- chart component files ---'
fd -i 'chart' src components . 2>/dev/null | head -n 50

printf '%s\n' '--- chart implementation ---'
for f in $(fd -i 'chart' src components . 2>/dev/null | head -n 20); do
  echo "### $f"
  wc -l "$f"
  sed -n '1,260p' "$f"
done

printf '%s\n' '--- chart package versions ---'
rg -n '"recharts"|"`@radix-ui/react-visually-hidden`"|"shadcn"' package.json pnpm-lock.yaml yarn.lock package-lock.json 2>/dev/null | head -n 80

Repository: rqms40/gridgo-web

Length of output: 16945


🌐 Web query:

Recharts 3.8 accessibilityLayer aria-label BarChart accessible name SVG ChartContainer

💡 Result:

In Recharts 3.8, accessibility support is enabled by default for all chart types, including BarChart [1][2][3]. The accessibilityLayer prop defaults to true, which automatically provides screen reader and keyboard navigation support [1][2]. Key details regarding Recharts 3.8 accessibility: 1. Accessibility Layer Behavior: When accessibilityLayer is enabled (default), the chart adds an aria role of "application" (which can be overridden with a custom role prop) and sets tabIndex={0} to include the chart in the tab order [1][2]. It also enables keyboard navigation using the ArrowLeft and ArrowRight keys to traverse data points and update tooltips [1][2]. 2. Accessible Names and SVG: Recharts does not automatically inject a unique accessible name (such as an aria-label) onto the root SVG element itself by default. If you need the chart to have an accessible name for WCAG compliance, you should manually add an aria-label or title to the wrapper element or the Chart component if the API permits [4]. Note that while ResponsiveContainer now supports passing through HTML attributes like aria-label, ensure you are using a version where these are correctly forwarded to the underlying DOM node, as this has been a subject of recent feature updates [4]. 3. Best Practices: To ensure your charts meet accessibility standards, it is recommended to provide descriptive text, use sufficient color contrast, and test with screen readers [5][6]. If you encounter warnings about an SVG element lacking an accessible name, you may need to explicitly define the role or add a title/label, as the library does not assume the purpose of the chart for you [7][8]. For developers needing to customize these features, you can pass explicit props (e.g., role="img" or aria-label="...") to the chart component. If you encounter issues where attributes are not being passed through, verify your container implementation, as some wrapper components may require specific configurations to forward attributes to the rendered output [4].

Citations:


🏁 Script executed:

#!/bin/bash
set -e

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

curl -fsSL \
  https://raw.githubusercontent.com/recharts/recharts/v3.8.0/src/chart/generateCategoricalChart.tsx \
  -o "$tmpdir/generateCategoricalChart.tsx"
curl -fsSL \
  https://raw.githubusercontent.com/recharts/recharts/v3.8.0/src/chart/AccessibilityLayer.tsx \
  -o "$tmpdir/AccessibilityLayer.tsx"
curl -fsSL \
  https://raw.githubusercontent.com/recharts/recharts/v3.8.0/src/container/Surface.tsx \
  -o "$tmpdir/Surface.tsx"

printf '%s\n' '--- accessibility layer ---'
rg -n -C 8 'accessibilityLayer|aria-label|aria-labelledby|role|tabIndex' "$tmpdir" || true

printf '%s\n' '--- chart prop forwarding ---'
rg -n -C 8 'Surface|accessibilityLayer|...props|props' "$tmpdir/generateCategoricalChart.tsx" | head -n 240

Repository: rqms40/gridgo-web

Length of output: 206


🏁 Script executed:

#!/bin/bash
set -e

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

curl -fsSL https://api.github.com/repos/recharts/recharts/git/trees/v3.8.0?recursive=1 \
  -o "$tmpdir/tree.json"

printf '%s\n' '--- accessibility-related source paths ---'
jq -r '.tree[] | select(.path | test("Accessibility|Surface|generateCategoricalChart|accessibility"; "i")) | .path' \
  "$tmpdir/tree.json"

printf '%s\n' '--- chart source paths ---'
jq -r '.tree[] | select(.path | test("src/.*/chart|src/.*/container"; "i")) | .path' \
  "$tmpdir/tree.json" | head -n 120

Repository: rqms40/gridgo-web

Length of output: 1255


🏁 Script executed:

#!/bin/bash
set -e

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

for path in \
  src/container/RootSurface.tsx \
  src/container/Surface.tsx \
  src/context/accessibilityContext.tsx \
  src/chart/generateCategoricalChart.tsx \
  src/chart/AccessibilityLayer.tsx \
  test/chart/AccessibilityLayer.spec.tsx \
  storybook/stories/API/Accessibility.mdx
do
  url="https://raw.githubusercontent.com/recharts/recharts/v3.8.0/$path"
  if curl -fsSL "$url" -o "$tmpdir/$(basename "$path")"; then
    echo "### $path"
    rg -n -C 8 'aria-label|aria-labelledby|accessibilityLayer|role|tabIndex|Surface|RootSurface' \
      "$tmpdir/$(basename "$path")" || true
  else
    echo "### unavailable: $path"
  fi
done

Repository: rqms40/gridgo-web

Length of output: 29684


Label the Recharts chart

Pass aria-label or aria-labelledby="method-heading" to BarChart. ChartContainer applies the label to its wrapper <div>, while accessibilityLayer places the accessible role and keyboard target on the inner <svg>.

🤖 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/app/admin/finance/page.tsx` around lines 325 - 330, Move the accessible
chart label from ChartContainer to the inner BarChart in the payment-method
chart, using aria-label or aria-labelledby="method-heading". Keep
accessibilityLayer enabled so the label is applied to the SVG’s accessible role
and keyboard target.

Comment thread src/app/globals.css
Comment on lines +531 to +532
box-shadow:
var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the Stylelint declaration-empty-line-before error.

Stylelint reports an error on the reformatted box-shadow declaration. Add a blank line before it.

🎨 Proposed fix
   --tw-ring-shadow: 0 0 `#0000`;
   --tw-ring-offset-shadow: 0 0 `#0000`;
+
   box-shadow:
     var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 `#0000`);
🧰 Tools
🪛 Stylelint (17.14.0)

[error] 531-532: Expected empty line before declaration (declaration-empty-line-before)

(declaration-empty-line-before)

🤖 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/app/globals.css` around lines 531 - 532, Add a blank line immediately
before the multiline box-shadow declaration in the affected stylesheet rule to
satisfy Stylelint’s declaration-empty-line-before requirement, without changing
the declaration’s values.

Source: Linters/SAST tools

Comment thread src/app/globals.css
Comment on lines +548 to +554
/* Registry controls inherit GRIDGO's 44px touch-target floor globally. */
[data-slot="toggle"],
[data-sidebar="menu-button"],
[data-slot="dropdown-menu-item"] {
min-height: 44px;
min-width: 44px;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

The 44px floor misses toggle-group-item.

src/components/ui/toggle-group.tsx Line 68 sets data-slot="toggle-group-item", not data-slot="toggle". The selector list here therefore does not match group items.

Those items keep the h-8 height from toggleVariants in src/components/ui/toggle.tsx Line 18. The PR uses them for the day/week schedule selector and the two-option claim hold choice, so the primary segmented controls in this change stay at 32px.

♿ Proposed fix
 /* Registry controls inherit GRIDGO's 44px touch-target floor globally. */
 [data-slot="toggle"],
+[data-slot="toggle-group-item"],
 [data-sidebar="menu-button"],
 [data-slot="dropdown-menu-item"] {
   min-height: 44px;
   min-width: 44px;
 }

As per coding guidelines: "Controls must have a minimum 44×44 touch target".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/* Registry controls inherit GRIDGO's 44px touch-target floor globally. */
[data-slot="toggle"],
[data-sidebar="menu-button"],
[data-slot="dropdown-menu-item"] {
min-height: 44px;
min-width: 44px;
}
/* Registry controls inherit GRIDGO's 44px touch-target floor globally. */
[data-slot="toggle"],
[data-slot="toggle-group-item"],
[data-sidebar="menu-button"],
[data-slot="dropdown-menu-item"] {
min-height: 44px;
min-width: 44px;
}
🤖 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/app/globals.css` around lines 548 - 554, Update the global selector list
for the 44px touch-target floor to include [data-slot="toggle-group-item"]
alongside the existing control selectors. Keep the current min-height and
min-width declarations unchanged so toggle-group items used by the schedule and
claim-choice controls meet the 44×44 requirement.

Source: Coding guidelines

Comment on lines +535 to +589
<AlertDialog
open={dialog?.type === "hold" || dialog?.type === "release"}
onOpenChange={(open) => {
if (!open) setDialog(null);
}}
>
<AlertDialogContent className="sm:max-w-md">
<AlertDialogHeader>
<AlertDialogTitle>
{dialog?.type === "hold"
? "Hold this payout?"
: "Release this payout hold?"}
</AlertDialogTitle>
<AlertDialogDescription>
{dialog?.type === "hold"
? "The supplier cannot receive this payout until Operations releases the hold. Record the reason for the claim and audit trail."
: "This removes the claim’s payment block. Payout can proceed when the order is complete, and the release is recorded on the audit trail."}
</AlertDialogDescription>
</AlertDialogHeader>
<FieldGroup>
<Field>
<FieldLabel htmlFor="payout-action-reason">Reason</FieldLabel>
<Textarea
id="payout-action-reason"
value={reason}
onChange={(event) => setReason(event.target.value)}
rows={3}
required
placeholder="What happened and why this action is required"
/>
</Field>
</FieldGroup>
{actionError ? (
<p className="text-body text-error m-0" role="alert">
{actionError}
</p>
) : null}
<AlertDialogFooter>
<AlertDialogCancel variant="secondary" disabled={submitting}>
Cancel
</AlertDialogCancel>
<AlertDialogAction
variant={dialog?.type === "hold" ? "danger" : "primary"}
disabled={submitting}
onClick={() => void submitDialog()}
>
{submitting
? "Saving…"
: dialog?.type === "hold"
? "Hold payout"
: "Release hold"}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Separate payout-reason entry from the confirmation dialog.

Lines 554-565 make the AlertDialog a modal input task because the operator must enter a reason. Collect the reason in Dialog. If a final irreversible-action confirmation is required, open AlertDialog after the reason is valid.

As per coding guidelines, use Dialog for modal input tasks, and AlertDialog for destructive or irreversible confirmations.

🤖 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/app/ops/claims/page.tsx` around lines 535 - 589, Separate the
reason-entry flow from the confirmation flow: replace the input-bearing
AlertDialog around submitDialog with a Dialog that collects and validates
reason, then open a distinct AlertDialog only when confirming the hold or
release action. Update the dialog state and submit handlers so the final action
proceeds only after the reason is valid, while preserving the existing
hold/release labels, errors, loading state, and cancellation behavior.

Source: Coding guidelines

Comment on lines +42 to +56
function BreadcrumbLink({ className, render, ...props }: useRender.ComponentProps<"a">) {
return useRender({
defaultTagName: "a",
props: mergeProps<"a">(
{
className: cn("transition-colors hover:text-foreground", className),
},
props,
),
render,
state: {
slot: "breadcrumb-link",
},
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

BreadcrumbLink has no touch-target floor.

The rendered anchor is sized by its text only, so its height is about 20px. src/components/shell/AppShell.tsx Line 194 renders it as the parent-queue link in the header, which makes it a real navigation control on tablet widths. The 44px floor added in src/app/globals.css Lines 549-553 covers toggle, sidebar-menu-button, and dropdown-menu-item, but not this slot.

Add vertical padding or extend the global floor rule to [data-slot="breadcrumb-link"].

♿ Proposed fix
       {
-        className: cn("transition-colors hover:text-foreground", className),
+        className: cn(
+          "inline-flex min-h-11 items-center transition-colors hover:text-foreground",
+          className,
+        ),
       },

As per coding guidelines: "Controls must have a minimum 44×44 touch target, visible :focus-visible treatment with the global 2px outline".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function BreadcrumbLink({ className, render, ...props }: useRender.ComponentProps<"a">) {
return useRender({
defaultTagName: "a",
props: mergeProps<"a">(
{
className: cn("transition-colors hover:text-foreground", className),
},
props,
),
render,
state: {
slot: "breadcrumb-link",
},
});
}
function BreadcrumbLink({ className, render, ...props }: useRender.ComponentProps<"a">) {
return useRender({
defaultTagName: "a",
props: mergeProps<"a">(
{
className: cn(
"inline-flex min-h-11 items-center transition-colors hover:text-foreground",
className,
),
},
props,
),
render,
state: {
slot: "breadcrumb-link",
},
});
}
🤖 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/components/ui/breadcrumb.tsx` around lines 42 - 56, Update BreadcrumbLink
to provide a minimum 44px touch target, preferably by adding appropriate
vertical padding or by extending the existing global 44px floor rule to
[data-slot="breadcrumb-link"]. Preserve its current hover styling and ensure the
control retains the global visible :focus-visible 2px outline treatment.

Source: Coding guidelines

Comment on lines +247 to +271
function SidebarTrigger({
className,
onClick,
...props
}: React.ComponentProps<typeof Button>) {
const { toggleSidebar } = useSidebar();

return (
<Button
data-sidebar="trigger"
data-slot="sidebar-trigger"
variant="ghost"
size="icon-sm"
className={cn(className)}
onClick={(event) => {
onClick?.(event);
toggleSidebar();
}}
{...props}
>
<PanelLeftIcon />
<span className="sr-only">Toggle Sidebar</span>
</Button>
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

SidebarTrigger is below the 44×44 touch-target floor.

The trigger renders with size="icon-sm" and carries data-slot="sidebar-trigger". The global floor added in src/app/globals.css Lines 549-553 covers [data-slot="toggle"], [data-sidebar="menu-button"], and [data-slot="dropdown-menu-item"]. It does not cover this slot.

src/components/shell/AppShell.tsx renders this trigger twice, at Line 114 and Line 187. On mobile it is the only control that opens the navigation Sheet, so it is the most important tap target in the shell.

Either add the slot to the global rule or set the size here.

♿ Proposed fix in `src/app/globals.css`
 [data-slot="toggle"],
 [data-sidebar="menu-button"],
+[data-slot="sidebar-trigger"],
 [data-slot="dropdown-menu-item"] {
   min-height: 44px;
   min-width: 44px;
 }

As per coding guidelines: "Controls must have a minimum 44×44 touch target, visible :focus-visible treatment with the global 2px outline, and icon-only controls must have accessible names."

🤖 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/components/ui/sidebar.tsx` around lines 247 - 271, Ensure SidebarTrigger
provides a minimum 44×44 touch target while preserving its existing accessible
name and focus treatment. Prefer updating the shared global touch-target rule to
include the data-slot="sidebar-trigger" selector, or equivalently change
SidebarTrigger’s button sizing from icon-sm to a 44px-compatible size; do not
alter its toggle behavior.

Source: Coding guidelines

Comment on lines +23 to +53
function ToggleGroup({
className,
variant,
size,
spacing = 2,
orientation = "horizontal",
children,
...props
}: ToggleGroupPrimitive.Props &
VariantProps<typeof toggleVariants> & {
spacing?: number;
orientation?: "horizontal" | "vertical";
}) {
return (
<ToggleGroupPrimitive
data-slot="toggle-group"
data-variant={variant}
data-size={size}
data-spacing={spacing}
data-orientation={orientation}
style={{ "--gap": spacing } as React.CSSProperties}
className={cn(
"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",
className,
)}
{...props}
>
<ToggleGroupContext.Provider value={{ variant, size, spacing, orientation }}>
{children}
</ToggleGroupContext.Provider>
</ToggleGroupPrimitive>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Base UI React ToggleGroup orientation prop data-vertical attribute

💡 Result:

In the Base UI React ToggleGroup component, the orientation prop is used to set the orientation of the toggle group [1][2]. This prop accepts either 'horizontal' (the default) or 'vertical' [1][3][2]. When the orientation prop is set, it determines the value of the data-orientation attribute applied to the component [1][4]. For example, if orientation="vertical" is passed, the component will render with the data-orientation="vertical" attribute [1][4]. Please note that there is no data-vertical attribute; the orientation is conveyed through the data-orientation attribute [1][4]. Furthermore, as of the current implementation, the orientation prop primarily affects this rendered data attribute and styling hooks rather than automatically restricting keyboard navigation to a single axis [5]. In the component's current design, keyboard navigation remains active on both axes regardless of the specified orientation [5].

Citations:


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- toggle-group.tsx ---'
cat -n src/components/ui/toggle-group.tsx
printf '%s\n' '--- Base UI dependency and related usage ---'
rg -n '"`@base-ui`|base-ui|ToggleGroupPrimitive|data-vertical|orientation=' package.json package-lock.json pnpm-lock.yaml yarn.lock src 2>/dev/null | head -200
printf '%s\n' '--- tracked package metadata ---'
git ls-files '*package*.json' '*lock*' | head -80

Repository: rqms40/gridgo-web

Length of output: 11572


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- local dependency artifacts ---'
find . -path '*/node_modules/@base-ui/react*' -o -path '*/node_modules/@base-ui/utils*' | head -50
printf '%s\n' '--- project styling/config files ---'
git ls-files | rg '(^|/)(globals?\.css|.*\.css|tailwind\.config\..*|postcss\.config\..*|components\.json)$' | head -100
printf '%s\n' '--- orientation-related wrapper patterns ---'
cat -n src/components/ui/tabs.tsx | sed -n '1,40p'
cat -n src/components/ui/scroll-area.tsx | sed -n '25,50p'
printf '%s\n' '--- package-lock Base UI metadata ---'
sed -n '565,590p' package-lock.json

Repository: rqms40/gridgo-web

Length of output: 3495


🌐 Web query:

Base UI React 1.7.0 ToggleGroup source orientation data-orientation keyboard navigation

💡 Result:

In Base UI React 1.7.0, the ToggleGroup component includes an orientation prop that dictates both the visual rendering and the constrained keyboard navigation of the component [1][2][3]. Orientation and Data Attributes The orientation prop accepts either 'horizontal' (default) or 'vertical' [1][2][3]. This prop is reflected on the component via the data-orientation attribute, allowing for styling based on the current orientation (e.g., [data-orientation="vertical"]) [1][2]. Keyboard Navigation Keyboard navigation in ToggleGroup is designed to be axis-constrained based on the orientation prop [4][3]: - When orientation="horizontal", focus navigation is restricted to the horizontal axis (Left/Right arrow keys) [5]. - When orientation="vertical", focus navigation is restricted to the vertical axis (Up/Down arrow keys) [5]. Historically, an issue existed where the orientation prop was not correctly forwarded to the underlying navigation logic, causing it to incorrectly support navigation on both axes regardless of the setting [5]. This behavior was addressed and fixed in pull request #4488 (merged April 1, 2026), ensuring that arrow key navigation respects the chosen orientation [4]. Additionally, the loopFocus prop (default true) determines whether keyboard navigation cycles back to the start when the end of the list is reached [1][6][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -e
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
curl -fsSL https://registry.npmjs.org/@base-ui/react/-/react-1.7.0.tgz -o "$tmpdir/base-ui.tgz"
tar -tzf "$tmpdir/base-ui.tgz" | rg 'toggle-group|toggleGroup' | head -40
printf '%s\n' '--- ToggleGroup package source excerpts ---'
tar -xOf "$tmpdir/base-ui.tgz" package/esm/toggle-group/index.js 2>/dev/null | sed -n '1,260p' || true
tar -xOf "$tmpdir/base-ui.tgz" package/esm/toggle-group/ToggleGroup.js 2>/dev/null | sed -n '1,260p' || true
printf '%s\n' '--- ToggleGroup type declarations ---'
for f in package/esm/toggle-group/index.d.ts package/esm/toggle-group/ToggleGroup.d.ts; do
  tar -xOf "$tmpdir/base-ui.tgz" "$f" 2>/dev/null && break
done
printf '%s\n' '--- all orientation/data-vertical references in package ---'
tar -xzf "$tmpdir/base-ui.tgz" -C "$tmpdir"
rg -n -C 2 'data-vertical|data-orientation|orientation|ArrowUp|ArrowDown|ArrowLeft|ArrowRight' "$tmpdir/package/esm/toggle-group" | head -240

Repository: rqms40/gridgo-web

Length of output: 1164


🌐 Web query:

site:github.com/mui/base-ui ToggleGroup.tsx orientation data-vertical @base-ui/react 1.7.0

💡 Result:

In @base-ui/react, the ToggleGroup component includes an orientation prop which defaults to 'horizontal' [1]. This prop is used to control the rendered data-orientation attribute on the component [2][3]. However, it is important to note that, as of recent versions, the orientation prop does not currently constrain or affect keyboard navigation behavior within the ToggleGroup [2]. Keyboard navigation is managed by the underlying CompositeRoot component, which typically defaults to multi-directional navigation (allowing movement in all directions regardless of the orientation prop) [2]. Regarding the data-orientation attribute and accessibility: - The component exposes the data-orientation attribute, which reflects the current orientation prop [3]. - In earlier versions, ToggleGroup rendered an aria-orientation attribute; however, this was removed because aria-orientation is not a valid attribute for an element with role="group" [4][5]. Subsequent updates ensured that aria-orientation is excluded from the rendered DOM to maintain ARIA compliance while still allowing the orientation prop to function for other internal logic [4]. If you are working with version 1.7.0, the component continues to follow this architectural pattern [6]. If your implementation requires restricting keyboard navigation to a specific axis, this is currently a known limitation of the component's implementation of CompositeRoot [2].

Citations:


🏁 Script executed:

#!/bin/bash
set -e
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
curl -fsSL https://registry.npmjs.org/@base-ui/react/-/react-1.7.0.tgz -o "$tmpdir/base-ui.tgz"
tar -xzf "$tmpdir/base-ui.tgz" -C "$tmpdir"
printf '%s\n' '--- ToggleGroup implementation ---'
cat -n "$tmpdir/package/toggle-group/ToggleGroup.js" | sed -n '1,280p'
printf '%s\n' '--- ToggleGroup data attributes ---'
cat -n "$tmpdir/package/toggle-group/ToggleGroupDataAttributes.js" | sed -n '1,180p'
printf '%s\n' '--- ToggleGroup declarations ---'
cat -n "$tmpdir/package/toggle-group/ToggleGroup.d.ts" | sed -n '1,220p'
printf '%s\n' '--- ToggleGroup orientation/navigation references ---'
rg -n -C 3 'data-vertical|data-horizontal|data-orientation|orientation|ArrowUp|ArrowDown|ArrowLeft|ArrowRight|Composite' "$tmpdir/package/toggle-group" "$tmpdir/package/composite" "$tmpdir/package" 2>/dev/null | head -320

Repository: rqms40/gridgo-web

Length of output: 36140


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- project CSS variants and Tailwind directives ---'
rg -n -C 2 'custom-variant|data-(vertical|horizontal)|`@theme`|tailwind|orientation' src/app/globals.css postcss.config.mjs components.json src/components/ui/toggle-group.tsx src/components/ui/tabs.tsx src/components/ui/scroll-area.tsx
printf '%s\n' '--- all vertical/horizontal data selectors in source ---'
rg -n 'data-(vertical|horizontal)|group-data-(vertical|horizontal)' src --glob '*.{ts,tsx,css}' | head -160

Repository: rqms40/gridgo-web

Length of output: 12914


Forward orientation and update the vertical selectors. Without the prop, vertical groups use horizontal arrow-key navigation. Base UI exposes data-orientation, not data-vertical, so the current vertical layout and item selectors do not match.

🤖 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/components/ui/toggle-group.tsx` around lines 23 - 53, Update ToggleGroup
to explicitly forward the orientation prop to ToggleGroupPrimitive so its
data-orientation attribute is applied, and replace the data-vertical layout
selector with selectors targeting data-orientation="vertical" for the container
and related item styles. Preserve the existing horizontal behavior and context
values.

Comment on lines +43 to +45
style={{ "--gap": spacing } as React.CSSProperties}
className={cn(
"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Tailwind CSS v4 --spacing() theme function with var() argument in arbitrary value

💡 Result:

In Tailwind CSS v4, the --spacing CSS function is designed to calculate values based on the --spacing theme variable [1][2][3]. When you use --spacing(n), it effectively resolves to calc(var(--spacing) * n) [1][2][3]. Regarding your query about using a var argument within an arbitrary value (e.g., m-[--spacing(var(--my-multiplier))]), the --spacing function expects a numeric multiplier as its argument [3]. Because --spacing is a CSS function evaluated by Tailwind at build time (or during JIT processing), it cannot dynamically ingest a CSS variable (via var) as its multiplier argument [3]. If you need to use a CSS variable to dynamically scale spacing, you should bypass the --spacing function and use calc directly with your theme variable, as this allows the browser to resolve the variable at runtime [4][5]:.element { /* This works as expected in the browser */ margin: calc(var(--spacing) * var(--my-multiplier)); } If you require the specific behavior of Tailwind's spacing scale (which automatically handles unit conversions based on your --spacing definition), you must provide a hardcoded number to --spacing (e.g., --spacing(4)) [1][2][3]. The --spacing function cannot evaluate dynamic runtime values passed via var because it is an abstraction layer that generates the multiplication calc string during processing [1][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- toggle-group.tsx ---'
cat -n src/components/ui/toggle-group.tsx
printf '%s\n' '--- Tailwind/package references ---'
rg -n --glob 'package.json' --glob '*tailwind*' --glob 'tailwind.config.*' 'tailwind|`@tailwind`|--spacing' .
printf '%s\n' '--- ToggleGroup usage ---'
rg -n 'ToggleGroup|orientation=|spacing=' src

Repository: rqms40/gridgo-web

Length of output: 8293


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- package versions ---'
sed -n '1,90p' package.json
rg -n -A8 -B3 '"`@base-ui/react`"|node_modules/@base-ui/react|toggle-group' package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null || true
printf '%s\n' '--- Tailwind configuration and styles ---'
fd -i 'tailwind|postcss|globals|css' . --type f | head -80
rg -n --glob '*.css' --glob '*.ts' --glob '*.tsx' -- '--spacing|`@theme`|--spacing' src .

Repository: rqms40/gridgo-web

Length of output: 8670


🌐 Web query:

Base UI React ToggleGroup orientation prop keyboard navigation @base-ui/react/toggle-group``

💡 Result:

The ToggleGroup component in @base-ui/react accepts an orientation prop ('horizontal' or 'vertical') that defaults to 'horizontal' [1][2][3]. Previously, this prop only controlled the data-orientation attribute and did not restrict keyboard navigation to the intended axis [4]. However, this behavior was corrected in April 2026 (via PR #4488), ensuring that the keyboard navigation now respects the specified orientation [5]. When orientation is set to 'vertical', keyboard focus navigation is now constrained to the vertical axis (ArrowUp/ArrowDown), while the horizontal axis keys are ignored for navigation [4][5]. Similarly, when set to 'horizontal', navigation is restricted to the horizontal axis (ArrowLeft/ArrowRight) [4]. This ensures consistent and expected behavior where only one axis is used for navigation at a time [4][5].

Citations:


🌐 Web query:

Tailwind CSS v4 arbitrary value gap-[--spacing(var(--gap))] generated CSS var function

💡 Result:

In Tailwind CSS v4, the syntax for using arbitrary values with CSS variables has been updated to improve clarity and reduce ambiguity [1]. The primary mechanism for using CSS variables as arbitrary values is the parentheses-based syntax ( ), which acts as a shorthand that automatically wraps the contents in a var() function [2][1]. Regarding your specific query about gap-[--spacing(var(--gap))], this syntax is likely invalid or redundant in Tailwind v4 for the following reasons: 1. Syntax for Variables: If you want to use a CSS variable as an arbitrary gap value, the recommended shorthand is gap-(--gap). Tailwind will automatically resolve this to gap: var(--gap); [2][1]. 2. Spacing Functions: Tailwind v4 introduced a CSS-level --spacing() function for use within your own CSS files (e.g., .my-element { width: --spacing(60); }) [3]. However, this function is generally not used inside the HTML class attribute's arbitrary value syntax in this manner. 3. Combining Values: If you need to perform a calculation involving spacing and a variable, you should use the standard CSS calc() function inside the square bracket notation. For example: - gap-[calc(var(--spacing)*var(--gap))] If you are attempting to use a custom spacing scale or variable, you can reference theme-generated CSS variables directly (which Tailwind v4 creates for all theme values) [4]. If Tailwind encounters ambiguity (such as when a utility might be interpreted as multiple CSS properties), you can use a type hint prefix inside the brackets, for example: gap-[length:var(--gap)] [5][6]. Summary of Key v4 Syntax Changes: - Variable Shorthand: bg-[--color] is replaced by bg-(--color) [1]. - Arbitrary Values: Continue to use [ ] for static, raw CSS values (e.g., gap-[10px]) [5][7]. - Combining: Use calc() within [ ] for dynamic math (e.g., gap-[calc(var(--spacing)*4)]) [4].

Citations:


Fix the toggle group gap and orientation

  • --gap receives a unitless number, but --spacing() cannot resolve a runtime var() multiplier. Use --gap: calc(var(--spacing) * ${spacing}) with gap-(--gap).
  • Pass orientation={orientation} to ToggleGroupPrimitive; data-orientation alone does not configure Base UI keyboard navigation.
🤖 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/components/ui/toggle-group.tsx` around lines 43 - 45, Update the toggle
group styling in the component rendering the shown className so the runtime
spacing value is defined as a calculated CSS length using the spacing variable
and configured multiplier, then reference it with the gap custom-property
utility instead of the current spacing function. Also pass the existing
orientation value to ToggleGroupPrimitive via its orientation prop, while
retaining the data-orientation styling behavior.

Comment on lines +8 to +9
const toggleVariants = cva(
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

The toggle focus treatment contradicts the GRIDGO focus rule.

Line 9 sets outline-none and then focus-visible:ring-[3px] focus-visible:ring-ring/50. ring-[3px] is the 3px ring that the guidelines prohibit as the sole focus signal, and outline-none suppresses the outline that should replace it.

src/app/globals.css Lines 544-545 also reset --tw-ring-shadow to 0 0 #0000`` for matched controls. If that reset wins, a focused toggle shows no visible focus indicator at all.

Drop the ring utilities and let the global outline apply.

♿ Proposed fix
 const toggleVariants = cva(
-  "group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+  "group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-pressed:bg-muted data-[state=on]:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",

As per coding guidelines: "Use the global 2px outline focus treatment on --foreground; do not use ring-3 as the only focus signal."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const toggleVariants = cva(
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
const toggleVariants = cva(
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-pressed:bg-muted data-[state=on]:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
🤖 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/components/ui/toggle.tsx` around lines 8 - 9, Update the toggleVariants
class definition to remove outline-none and the focus-visible ring utilities,
allowing the global 2px foreground outline focus treatment to apply. Preserve
the remaining toggle styling unchanged.

Source: Coding guidelines

@rqms40
rqms40 merged commit a4e491d into main Aug 10, 2026
1 check passed
@rqms40
rqms40 deleted the fm/gridgo-web-shadcn-complete branch August 13, 2026 03:19
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.

1 participant