feat (Tabs): Add a few improvements and some minor fixes#664
feat (Tabs): Add a few improvements and some minor fixes#664paanSinghCoder wants to merge 2 commits intomainfrom
Conversation
- Introduced a new Tabs component in the examples page with three tabs: Account, Password (disabled), and Settings. - Updated CSS for the Tabs component to use responsive height and added a media query for reduced motion accessibility. - Enhanced the TabsTab component to include aria-hidden for leading icons for better accessibility.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds a Tabs example to the website, updates Tabs styles to use design tokens and respects reduced-motion, marks leading icon as decorative with Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/www/src/app/examples/page.tsx (1)
147-151: Optional: include oneleadingIcontab in the example to exercise the new a11y path.This would validate and showcase the
aria-hiddenicon behavior introduced inpackages/raystack/components/tabs/tabs.tsx.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/www/src/app/examples/page.tsx` around lines 147 - 151, Add one Tabs.Tab in the example that uses the new leadingIcon prop so the accessible icon code path in packages/raystack/components/tabs/tabs.tsx is exercised; update the existing tab list (where Tabs.Tab values 'tab1'/'tab2'/'tab3' are declared) to include a tab such as Tabs.Tab value='tab-left' leadingIcon={<SomeIcon />} (keep one normal tab and one disabled tab as-is) so the example renders an icon with the aria-hidden behavior from the Tabs component and visually demonstrates the new accessibility behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/www/src/app/examples/page.tsx`:
- Around line 147-151: Add one Tabs.Tab in the example that uses the new
leadingIcon prop so the accessible icon code path in
packages/raystack/components/tabs/tabs.tsx is exercised; update the existing tab
list (where Tabs.Tab values 'tab1'/'tab2'/'tab3' are declared) to include a tab
such as Tabs.Tab value='tab-left' leadingIcon={<SomeIcon />} (keep one normal
tab and one disabled tab as-is) so the example renders an icon with the
aria-hidden behavior from the Tabs component and visually demonstrates the new
accessibility behavior.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/www/src/app/examples/page.tsxpackages/raystack/components/tabs/tabs.module.csspackages/raystack/components/tabs/tabs.tsx
- Updated Tabs component to wrap leading icons with `aria-hidden` for improved screen reader support. - Modified documentation to reflect the accessibility changes for leading icons. - Ensured tab indicator respects `prefers-reduced-motion` settings to enhance user experience for those with motion sensitivity. - Added a test to verify `aria-hidden` attribute on leading icon wrapper.
Issue-581
Summary
Improvement: Replace hardcoded CSS values with design tokens (Issue-643)- DoneFix: Add aria-hidden control for leadingIcon (Issue-643)- Added a aria-hidden property for the iconFeat: Add prefer-reduced-motion media query- It matches when the user has asked the OS/browser for less or no motion (e.g. “Reduce motion” in accessibility settings).Items which are already present and does not require any changes.
Fix: The inactive color is too dark, should be lighter.- Already matches the design.Active tab border is not crisp.- Already matches the design.Lazy Content Loading - Load heavy content after Tab is focused.- Implemented during Base UI. check - Supported. Inactive tab panels are unmounted by default (keepMounted: false), so heavy content only mounts when that tab is selected. Base UI DocsFull Width Option - Tabs are already full width. Confirm- Already supportedType of Change
How Has This Been Tested?
Manual and added tests
Checklist:
Screenshots (if appropriate):
[Add screenshots here]
Related Issues
[Link any related issues here using #issue-number]
Summary by CodeRabbit
New Features
Improvements
Accessibility
Tests