Skip to content

feat: enhance tab navigation with scroll buttons and improve code for…#86

Merged
kzamanbd merged 2 commits intomainfrom
update/dataviews-tab
Apr 21, 2026
Merged

feat: enhance tab navigation with scroll buttons and improve code for…#86
kzamanbd merged 2 commits intomainfrom
update/dataviews-tab

Conversation

@kzamanbd
Copy link
Copy Markdown
Contributor

@kzamanbd kzamanbd commented Apr 21, 2026

…matting

Summary by CodeRabbit

  • New Features

    • Introduced horizontal scrolling navigation for data view tabs with left and right arrow controls that appear based on scroll position.
  • Refactor

    • Enhanced type declarations and reformatted code for improved readability and maintainability.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@kzamanbd has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 54 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 35 minutes and 54 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2aefd915-c81e-41f3-96ee-9f991da46ea9

📥 Commits

Reviewing files that changed from the base of the PR and between f84cf3f and 3d63cfd.

📒 Files selected for processing (1)
  • src/components/wordpress/dataviews.tsx
📝 Walkthrough

Walkthrough

A component enhancement that adds horizontal scroll controls to tabs in DataViews. The implementation introduces scroll state tracking via refs and state, integrates ResizeObserver for dynamic scroll capability detection, and adds conditional arrow button UI for navigation without altering existing logic.

Changes

Cohort / File(s) Summary
Tab Horizontal Scrolling Enhancement
src/components/wordpress/dataviews.tsx
Added ChevronLeft and ChevronRight imports. Tightened TypeScript typing for window.wp.hooks declarations. Introduced tab scroll state management (tabsScrollRef, canScrollTabsLeft, canScrollTabsRight) with callbacks for scroll updates (updateTabsScrollState) and arrow-triggered scrolling (scrollTabsByArrow). Implemented scroll event listener and ResizeObserver integration within an effect hook to dynamically track scrollability and handle cleanup. Replaced static header with conditional left/right arrow Button UI wrapping the tabs container. Applied JSX and conditional formatting improvements throughout without functional changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hop, hop, scroll and play!
Tabs now glide the scrolling way,
Left and right with arrow cheer,
ResizeObserver keeps it clear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding scroll buttons for tab navigation and code formatting improvements, matching the substantial refactoring in dataviews.tsx.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update/dataviews-tab

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

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/wordpress/dataviews.tsx`:
- Around line 907-971: The left/right arrow Buttons should not be conditionally
unmounted (which causes focus loss); always render both Button elements next to
the tabs container and toggle their disabled state based on
canScrollTabsLeft/canScrollTabsRight and make onClick a no-op when disabled (use
scrollTabsByArrow('left'|'right') only when enabled). Update the Button render
around tabsScrollRef so both Buttons are present, use the btn props
variant/size/className and wrap className values with cn(...) (as required by
src/components/**/*.{ts,tsx}) to merge Tailwind classes, and keep existing
aria-labels and Chevron icons unchanged so keyboard users retain focus while
arrows are visually/operationally unavailable.
- Around line 97-100: Guard against null before calling Object.keys on
v.filters: change the condition that sets the local variable filters (currently
using typeof v.filters === 'object') to also verify v.filters is not null (e.g.,
v.filters != null) and that it has keys (Object.keys(v.filters).length > 0);
update the assignment for filters (the variable named filters derived from
v.filters) to only JSON.stringify when v.filters is non-null and an object with
keys, otherwise set filters to null.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 43929e56-28ff-46ec-bafb-ad18dd134c2a

📥 Commits

Reviewing files that changed from the base of the PR and between 1613872 and f84cf3f.

📒 Files selected for processing (1)
  • src/components/wordpress/dataviews.tsx

Comment thread src/components/wordpress/dataviews.tsx Outdated
Comment thread src/components/wordpress/dataviews.tsx
@kzamanbd kzamanbd merged commit 20ab29f into main Apr 21, 2026
1 check passed
@kzamanbd kzamanbd deleted the update/dataviews-tab branch April 21, 2026 09:32
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