Repository navigation
Complete the portal shadcn primitive set - #8
Conversation
📝 WalkthroughWalkthroughThis 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. ChangesUI platform integration
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
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 liftKeep verification reason entry in
Dialog.Lines 451-579 use
AlertDialogfor user verification, service activation, and suspension while collecting a reason. The verification and activation paths are not destructive confirmations. UseDialogfor these input workflows. If suspension needs an extra confirmation, showAlertDialogafter the reason form is complete.As per coding guidelines, use
Dialogfor modal input tasks, andAlertDialogfor 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 liftUse
Dialogfor 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 inDialogand showAlertDialogonly for the final high-risk confirmation.As per coding guidelines, use
Dialogfor modal input tasks, andAlertDialogfor 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 winConstrain the injected color values in
ChartStyle.
colorandtheme[...]flow unescaped into a<style>element. Today everyChartConfigis 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 winRead
mql.matchesinstead ofwindow.innerWidth.Line 9 builds the query from
MOBILE_BREAKPOINT - 1, and Lines 11 and 14 then recompute the same decision fromwindow.innerWidth.window.innerWidthincludes 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
MediaQueryListas 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 winSign 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 winThe sidebar cookie is written but never read.
setOpenwritessidebar_stateon every toggle (Line 82). No code in this file reads that cookie. Initial state comes only fromdefaultOpen, which defaults totrueat Line 53.src/components/shell/AppShell.tsxLine 182 renders<SidebarProvider>with nodefaultOpen, 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.
SidebarMenuSkeletonis a client component in the App Router. The server render and the client hydration produce different--skeleton-widthvalues, 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
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (22)
AGENTS.mdpackage.jsonsrc/app/admin/finance/page.tsxsrc/app/admin/roles/page.tsxsrc/app/admin/verification/page.tsxsrc/app/globals.csssrc/app/ops/claims/page.tsxsrc/app/ops/qa/[id]/page.tsxsrc/app/ops/schedule/page.tsxsrc/app/supplier/capacity/page.tsxsrc/app/supplier/catalogue/page.tsxsrc/app/supplier/jobs/[id]/page.tsxsrc/app/supplier/schedule/page.tsxsrc/components/shell/AppShell.tsxsrc/components/ui/alert-dialog.tsxsrc/components/ui/breadcrumb.tsxsrc/components/ui/chart.tsxsrc/components/ui/progress.tsxsrc/components/ui/sidebar.tsxsrc/components/ui/toggle-group.tsxsrc/components/ui/toggle.tsxsrc/hooks/use-mobile.ts
| const released = formatFigure(rollup.payoutReleased); | ||
| const codCollected = formatFigure(rollup.codCollected); | ||
| const codOutstanding = formatFigure(rollup.codOutstanding); | ||
| const paymentMethods = summariseMethods(orders); |
There was a problem hiding this comment.
🎯 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.
| <ChartContainer | ||
| config={paymentMethodChartConfig} | ||
| className="h-72 w-full" | ||
| aria-label="Order value by payment method" | ||
| > | ||
| <BarChart data={paymentMethods} accessibilityLayer> |
There was a problem hiding this comment.
🎯 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 300Repository: 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 80Repository: 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:
- 1: https://github.com/recharts/recharts/blob/main/storybook/stories/API/Accessibility.mdx
- 2: https://github.com/recharts/recharts/blob/v3.8.1/storybook/stories/API/Accessibility.mdx
- 3: docs: fix outdated accessibility docs for v3.0 defaults recharts/recharts#6165
- 4: feat: allow HTML attributes passthrough on ResponsiveContainer recharts/recharts#7168
- 5: https://www.mintlify.com/recharts/recharts/guides/accessibility
- 6: https://recharts-recharts.mintlify.app/guides/accessibility
- 7: Legend accessibility "The SVG element does not have accessible name" recharts/recharts#5412
- 8: Accessibility regression related to element roles recharts/recharts#3449
🏁 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 240Repository: 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 120Repository: 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
doneRepository: 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.
| box-shadow: | ||
| var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); |
There was a problem hiding this comment.
📐 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
| /* 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; | ||
| } |
There was a problem hiding this comment.
📐 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.
| /* 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
| <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> |
There was a problem hiding this comment.
📐 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
| 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", | ||
| }, | ||
| }); | ||
| } |
There was a problem hiding this comment.
📐 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.
| 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
| 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> | ||
| ); | ||
| } |
There was a problem hiding this comment.
📐 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
| 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> |
There was a problem hiding this comment.
🎯 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:
- 1: https://base-ui.com/react/components/toggle-group
- 2: https://mui-base-ui.mintlify.app/components/toggle-group
- 3: https://github.com/mui/base-ui/blob/master/packages/react/src/toggle-group/ToggleGroup.tsx
- 4: https://base-ui.com/react/components/toggle-group.md
- 5: ToggleGroup orientation prop does not affect keyboard navigation mui/base-ui#4487
🏁 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 -80Repository: 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.jsonRepository: 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:
- 1: https://base-ui.com/react/components/toggle-group.md
- 2: https://base-ui.com/react/components/toggle-group
- 3: https://mui-base-ui.mintlify.app/components/toggle-group
- 4: [toggle group] Fix incorrect keyboard nav on cross axis mui/base-ui#4488
- 5: ToggleGroup orientation prop does not affect keyboard navigation mui/base-ui#4487
- 6: https://github.com/mui/base-ui/blob/master/packages/react/src/toggle-group/ToggleGroup.tsx
🏁 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 -240Repository: 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:
- 1: https://github.com/mui/base-ui/blob/master/packages/react/src/toggle-group/ToggleGroup.tsx
- 2: ToggleGroup orientation prop does not affect keyboard navigation mui/base-ui#4487
- 3: https://github.com/mui/base-ui/blob/d81ec002/docs/src/app/(docs)/react/components/page.mdx
- 4: [toggle-group] Remove invalid aria-orientation from role="group" element mui/base-ui#4628
- 5: [ToggleGroup] aria-orientation not allowed on role=group element mui/base-ui#4623
- 6: https://github.com/mui/base-ui/releases/tag/v1.7.0
🏁 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 -320Repository: 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 -160Repository: 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.
| 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", |
There was a problem hiding this comment.
🎯 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:
- 1: Implement
--spacing(…),--alpha(…)and--theme(…)CSS functions tailwindlabs/tailwindcss#15572 - 2: https://mintlify.wiki/tailwindlabs/tailwindcss/api/css/theme-function
- 3: https://tailwindlabs-tailwindcss.mintlify.app/advanced/functions-directives
- 4: https://tailwindcss.com/docs/theme
- 5: https://tailwindcss.com/docs/adding-custom-styles
🏁 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=' srcRepository: 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:
- 1: https://github.com/mui/base-ui/blob/master/packages/react/src/toggle-group/ToggleGroup.tsx
- 2: https://base-ui.com/react/components/toggle-group.md
- 3: https://mui-base-ui.mintlify.app/components/toggle-group
- 4: ToggleGroup orientation prop does not affect keyboard navigation mui/base-ui#4487
- 5: [toggle group] Fix incorrect keyboard nav on cross axis mui/base-ui#4488
🌐 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:
- 1: https://tailwindcss.com/docs/upgrade-guide
- 2: https://tailwindcss.com/docs/gap
- 3: How do replace @apply when it comes to spacing? tailwindlabs/tailwindcss#19697
- 4: https://tailwindcss.com/docs/theme
- 5: https://tailwindcss.com/docs/adding-custom-styles
- 6: [v4] Border with arbitrary color using
vartailwindlabs/tailwindcss#14181 - 7: https://llmbestpractices.com/frontend/tailwind-arbitrary-values
Fix the toggle group gap and orientation
--gapreceives a unitless number, but--spacing()cannot resolve a runtimevar()multiplier. Use--gap: calc(var(--spacing) * ${spacing})withgap-(--gap).- Pass
orientation={orientation}toToggleGroupPrimitive;data-orientationalone 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.
| 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", |
There was a problem hiding this comment.
📐 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.
| 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
Summary
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
Summary by CodeRabbit
New Features
Usability