fix: wrap initial overflow ArrowUp to last tab - #1019
Conversation
|
@nrps9909 is attempting to deploy a commit to the afc163's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. Walkthrough修复溢出菜单首次按上箭头时的标签定位。新增测试,验证最后一个启用标签被选中。 Changes溢出菜单键盘导航
Estimated code review effort: 1 (简单) | ~5 分钟 Merge Risk: ⚪ Minimal · up to This narrowly scoped change makes the first ArrowUp action in the overflow menu select the last enabled tab while preserving existing ArrowDown behavior, with regression coverage and passing checks; no actionable merge-blocking risk remains. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
Summary\n\n- make the first ArrowUp press in the overflow menu wrap to the last enabled tab\n- preserve the existing first ArrowDown behavior\n- add a regression test with a disabled tab in the overflow sequence\n\n## Problem\n\nWhen the overflow menu opens, selectedKey is initially null. findIndex therefore returns -1. The existing modulo calculation works for ArrowDown (-1 + 1 -> 0), but ArrowUp advances from -1 to the second-to-last enabled tab instead of wrapping to the last one.\n\n## Validation\n\n- before the fix, the new test expected miu but selected cute\n- npm test -- tests/overflow.test.tsx --runInBand (22 tests)\n- npm test -- --runInBand (6 suites, 75 tests, 3 snapshots)\n- npm run tsc\n- npm run lint (0 errors; existing warnings only)\n- Prettier check and git diff --check\n\nAI assistance disclosure: Codex was used to trace the keyboard index calculation, add the regression test, run validation, and draft this description. I verified the reproduction, red/green result, diff, and test counts directly.
Summary by CodeRabbit
Bug 修复
测试