Skip to content

feat(inventory-list): add quick navigation for active/equipped items#169

Open
zndxcvbn wants to merge 2 commits into
mainfrom
feat-select-next-equip
Open

feat(inventory-list): add quick navigation for active/equipped items#169
zndxcvbn wants to merge 2 commits into
mainfrom
feat-select-next-equip

Conversation

@zndxcvbn

@zndxcvbn zndxcvbn commented Apr 19, 2026

Copy link
Copy Markdown
Collaborator

This PR introduces a quality-of-life improvement for inventory management, allowing players to quickly locate and cycle through their active gear without manual scrolling.

Key Changes:

  • New Navigation Logic: Implemented selectEquippedItem in InventoryLists.as which scans the list for items with an active equipState.
  • Bidirectional Support:
    • Ctrl + S or Ctrl + Down: Cycle forward.
    • Ctrl + W or Ctrl + Up: Cycle backward.

Summary by CodeRabbit

  • New Features
    • Added keyboard shortcuts (Ctrl+arrow keys) to navigate between equipped items in inventory and crafting menus. Selection cycles through equipped items and wraps around the list.

@coderabbitai

coderabbitai Bot commented Apr 19, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The pull request adds a new selectEquippedItem method to two inventory menu classes. This method enables keyboard shortcuts (Ctrl+arrow keys) to navigate directly to equipped items within filtered item lists, cycling through items with wraparound support and playing a focus sound upon selection.

Changes

Cohort / File(s) Summary
Equipped Item Selection Navigation
source/actionscript/CraftingMenu/CraftingLists.as, source/actionscript/ItemMenus/InventoryLists.as
Added selectEquippedItem method to both classes. Enables keyboard navigation (Ctrl+arrow keys for CraftingLists, Ctrl+W/S/Up/Down for InventoryLists) to cycle through equipped items within filtered lists with wraparound support and focus sound playback.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely describes the main change: adding quick navigation for equipped items in inventory lists, which matches the core functionality implemented across both files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.


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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@zndxcvbn zndxcvbn changed the title feat(invetory-list): add quick navigation for active/equipped items feat(inventory-list): add quick navigation for active/equipped items Apr 19, 2026
@zndxcvbn zndxcvbn marked this pull request as ready for review April 20, 2026 09:09
@zndxcvbn zndxcvbn marked this pull request as draft April 22, 2026 11:52
@zndxcvbn zndxcvbn marked this pull request as ready for review April 29, 2026 07:56
@zndxcvbn zndxcvbn marked this pull request as draft April 29, 2026 12:53
@zndxcvbn zndxcvbn force-pushed the feat-select-next-equip branch from 8115058 to 25ec76a Compare April 29, 2026 14:22
@zndxcvbn zndxcvbn force-pushed the feat-select-next-equip branch from 25ec76a to 3fccba8 Compare April 29, 2026 14:32
@zndxcvbn zndxcvbn marked this pull request as ready for review April 29, 2026 14:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@source/actionscript/CraftingMenu/CraftingLists.as`:
- Around line 198-205: The Ctrl+arrow/W/S shortcut block currently consumes
navigation even when the list/input is disabled or a modal/dialog is active;
modify the handler (the block checking isCtrl, kc, details.value and calling
selectEquippedItem) to first bail out when the list/input or UI is not
interactive — e.g., check this.itemList.enabled (and any modal/dialog flag such
as this.columnDialogOpen or similar) and return false so the event is not
consumed; only when the list is enabled/interactive should you proceed to
inspect details.value and call this.selectEquippedItem(dir).

In `@source/actionscript/ItemMenus/InventoryLists.as`:
- Around line 185-192: The Ctrl-key navigation block handles equipped-item
selection even when the UI list is disabled; add an early disabled-state guard
before processing isCtrl/kc events so the handler returns without changing
selection when the list is disabled (check the list's enabled/disabled flag used
by this component — e.g., this.enabled or this._disabled — and skip the block),
keeping the existing checks for isCtrl, kc, details.value and the call to
selectEquippedItem(dir) otherwise.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 53eb0e9a-8ee4-4b2c-ab6a-eecb0a45a954

📥 Commits

Reviewing files that changed from the base of the PR and between 1523d12 and 4c80c0c.

📒 Files selected for processing (2)
  • source/actionscript/CraftingMenu/CraftingLists.as
  • source/actionscript/ItemMenus/InventoryLists.as

Comment on lines +198 to +205
if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
if (details.value == "keyDown" || details.value == "keyHold") {
var dir = (kc == 83 || kc == 40) ? 1 : -1;
this.selectEquippedItem(dir);
return true;
}
if (details.value == "keyUp") return true;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Shortcut handler should respect disabled/modal list state

Line 198 currently consumes Ctrl navigation even when itemList input is disabled (e.g., search input or column dialog), which can cause unintended background selection changes.

Suggested fix
-      if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
+      var canNavigate = !this.itemList.disableInput && !this.itemList.disableSelection && this._columnSelectDialog == undefined;
+      if (canNavigate && isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
          if (details.value == "keyDown" || details.value == "keyHold") {
             var dir = (kc == 83 || kc == 40) ? 1 : -1;
             this.selectEquippedItem(dir);
             return true;
          }
          if (details.value == "keyUp") return true;
       }
📝 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.

Suggested change
if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
if (details.value == "keyDown" || details.value == "keyHold") {
var dir = (kc == 83 || kc == 40) ? 1 : -1;
this.selectEquippedItem(dir);
return true;
}
if (details.value == "keyUp") return true;
}
var canNavigate = !this.itemList.disableInput && !this.itemList.disableSelection && this._columnSelectDialog == undefined;
if (canNavigate && isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
if (details.value == "keyDown" || details.value == "keyHold") {
var dir = (kc == 83 || kc == 40) ? 1 : -1;
this.selectEquippedItem(dir);
return true;
}
if (details.value == "keyUp") return true;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@source/actionscript/CraftingMenu/CraftingLists.as` around lines 198 - 205,
The Ctrl+arrow/W/S shortcut block currently consumes navigation even when the
list/input is disabled or a modal/dialog is active; modify the handler (the
block checking isCtrl, kc, details.value and calling selectEquippedItem) to
first bail out when the list/input or UI is not interactive — e.g., check
this.itemList.enabled (and any modal/dialog flag such as this.columnDialogOpen
or similar) and return false so the event is not consumed; only when the list is
enabled/interactive should you proceed to inspect details.value and call
this.selectEquippedItem(dir).

Comment on lines +185 to +192
if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
if (details.value == "keyDown" || details.value == "keyHold") {
var dir = (kc == 83 || kc == 40) ? 1 : -1;
this.selectEquippedItem(dir);
return true;
}
if (details.value == "keyUp") return true;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing disabled-state guard on Ctrl navigation

Line 185 intercepts and executes equipped-item navigation even when the list is disabled by active UI flows, allowing hidden selection changes.

Suggested fix
-      if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
+      var canNavigate = !this.itemList.disableInput && !this.itemList.disableSelection && this._columnSelectDialog == undefined;
+      if (canNavigate && isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
          if (details.value == "keyDown" || details.value == "keyHold") {
             var dir = (kc == 83 || kc == 40) ? 1 : -1;
             this.selectEquippedItem(dir);
             return true;
          }
          if (details.value == "keyUp") return true;
       }
📝 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.

Suggested change
if (isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
if (details.value == "keyDown" || details.value == "keyHold") {
var dir = (kc == 83 || kc == 40) ? 1 : -1;
this.selectEquippedItem(dir);
return true;
}
if (details.value == "keyUp") return true;
}
var canNavigate = !this.itemList.disableInput && !this.itemList.disableSelection && this._columnSelectDialog == undefined;
if (canNavigate && isCtrl && (kc == 87 || kc == 38 || kc == 83 || kc == 40)) {
if (details.value == "keyDown" || details.value == "keyHold") {
var dir = (kc == 83 || kc == 40) ? 1 : -1;
this.selectEquippedItem(dir);
return true;
}
if (details.value == "keyUp") return true;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@source/actionscript/ItemMenus/InventoryLists.as` around lines 185 - 192, The
Ctrl-key navigation block handles equipped-item selection even when the UI list
is disabled; add an early disabled-state guard before processing isCtrl/kc
events so the handler returns without changing selection when the list is
disabled (check the list's enabled/disabled flag used by this component — e.g.,
this.enabled or this._disabled — and skip the block), keeping the existing
checks for isCtrl, kc, details.value and the call to selectEquippedItem(dir)
otherwise.

@zndxcvbn zndxcvbn added deferred Will be considered at a later date labels May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deferred Will be considered at a later date

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant