Skip to content

Fix(gallery): Re-add image browsing with arrow keys#8874

Open
DustyShoe wants to merge 3 commits intoinvoke-ai:mainfrom
DustyShoe:Fix(gallery)/image-browsing-with-arrow-keys
Open

Fix(gallery): Re-add image browsing with arrow keys#8874
DustyShoe wants to merge 3 commits intoinvoke-ai:mainfrom
DustyShoe:Fix(gallery)/image-browsing-with-arrow-keys

Conversation

@DustyShoe
Copy link
Collaborator

@DustyShoe DustyShoe commented Feb 14, 2026

Summary

This PR restores and hardens keyboard image browsing in Gallery/Viewer flows, including when panels are collapsed and when invoking from prompt-focused inputs.

Key Changes

  1. Restored arrow-key browsing behavior
  • Gallery arrow navigation works again in viewer-capable contexts.
  • No longer requires clicking a gallery item first in common viewer flows.
  1. Viewer-side Left/Right navigation when gallery is unavailable
  • Left/Right now navigate prev/next image when:
    • fullscreen panel mode is active, or
    • right panel is collapsed, or
    • gallery panel is collapsed.
  • Prevented handler conflicts by making grid hotkeys yield in viewer-arrow-navigation mode.
  1. Paged Gallery cross-page keyboard navigation
  • In paged mode, keyboard navigation indexes against full image list.
  • Crossing page boundaries via arrows automatically changes page/selection correctly.
  1. Shared prev/next navigation logic
  • Extracted shared hook:
    • useNextPrevItemNavigation
  • Both UI arrows (NextPrevItemButtons) and viewer hotkeys call the same prev/next logic.
  1. Navigation API additions
  • Added helpers in navigation-api:
    • isFullscreen(tab)
    • isRightPanelCollapsed(tab)
    • isGalleryPanelCollapsed(tab)
    • isViewerArrowNavigationMode(tab)
  1. Invoke focus behavior (Generate + Upscaling)
  • After invoke (button or hotkey), prompt/input focus is blurred and focus region is set to viewer in:
    • Generate
    • Upscaling
  • Ensures arrow browsing is immediately available after invoke from text input.

Related Issues / Discussions

Fixes #8589

QA Instructions

A. Baseline Gallery Keyboard Nav

  • Select image in visible gallery.
  • Press Left/Right/Up/Down.
  • Confirm selection moves as expected.

B. Viewer Without Extra Click

  • Open viewer-capable tab.
  • Do not click gallery item.
  • Press arrows.
  • Confirm browsing still works.

C. Right Panel Collapsed Only

  • Collapse only right panel (G).
  • Press Left/Right.
  • Confirm prev/next image navigation works.

D. Fullscreen / Panels Hidden

  • Toggle fullscreen panels mode (F).
  • Press Left/Right.
  • Confirm behavior matches viewer prev/next UI controls.

E. Paged Gallery Boundary

  • Enable paged gallery view.
  • Navigate to page boundary and press Left/Right.
  • Confirm automatic jump to previous/next page selection.

F. Invoke From Prompt Input

  • Focus prompt textarea in Generate, press Ctrl+Enter (Cmd+Enter on mac).
  • Confirm input focus is cleared and arrow browsing works immediately.
  • Repeat for Upscaling.
  • Repeat with Ctrl+Shift+Enter / Cmd+Shift+Enter.

G. Input Safety

  • Focus an input/textarea in contexts where viewer-arrow mode is not active.
  • Confirm arrows behave as text-cursor keys (no unintended image nav).

Merge Plan

Should be simple merge.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added the frontend PRs that change frontend files label Feb 14, 2026
@DustyShoe DustyShoe changed the title Fix(gallery)/image browsing with arrow keys Fix(gallery): Re-add image browsing with arrow keys Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend PRs that change frontend files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: Arrow keys no longer navigate gallery items after generating

1 participant