Skip to content

fix: wrap initial overflow ArrowUp to last tab - #1019

Open
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/fix-overflow-first-arrow-up
Open

fix: wrap initial overflow ArrowUp to last tab#1019
nrps9909 wants to merge 1 commit into
react-component:masterfrom
nrps9909:codex/fix-overflow-first-arrow-up

Conversation

@nrps9909

@nrps9909 nrps9909 commented Aug 27, 2026

Copy link
Copy Markdown

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 修复

    • 修复下拉标签导航中使用向上箭头时的选中位置问题。
    • 当未选中任何标签时,向上导航现在会正确选中最后一个启用的标签。
  • 测试

    • 新增键盘导航测试,验证向下打开菜单后按向上箭头可选中最后一个启用的标签。
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@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.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cc18d717-6e01-4816-a445-af6b2509b380

📥 Commits

Reviewing files that changed from the base of the PR and between dea2f5f and 50af9a7.

📒 Files selected for processing (2)
  • src/TabNavList/OperationNode.tsx
  • tests/overflow.test.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

修复溢出菜单首次按上箭头时的标签定位。新增测试,验证最后一个启用标签被选中。

Changes

溢出菜单键盘导航

Layer / File(s) Summary
修复选择索引并验证导航
src/TabNavList/OperationNode.tsx, tests/overflow.test.tsx
selectOffset 在未匹配 selectedKey 且方向为 -1 时将索引设为 0。测试验证先按 DOWN、再按 UP 时选中最后一个启用的 tab miu

Estimated code review effort: 1 (简单) | ~5 分钟

Merge Risk: ⚪ Minimal · up to 50af9

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

兔子按下上箭头,
标签跳到末尾旁。
miu 安静被选中,
测试记录键盘光。
索引修好不迷路。

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. 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 标题准确概括了主要变更:修复溢出菜单初始 ArrowUp 导航,使其回绕到最后一个启用的 tab。
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant