Skip to content

feat: add keyboard shortcuts for navigation (go back and go forward)#24

Open
qwdavid wants to merge 2 commits intoniklabh:mainfrom
qwdavid:add-shortcuts-back-forward
Open

feat: add keyboard shortcuts for navigation (go back and go forward)#24
qwdavid wants to merge 2 commits intoniklabh:mainfrom
qwdavid:add-shortcuts-back-forward

Conversation

@qwdavid
Copy link
Copy Markdown

@qwdavid qwdavid commented Mar 26, 2026

Partially implements #21

  • Alt + Left Arrow: go back
  • Alt + Right Arrow: go forward

These shortcuts call the existing go_back and go_forward methods on the active tab.

Summary by CodeRabbit

  • New Features

    • Added keyboard shortcuts for navigation: Alt+ArrowLeft to go back and Alt+ArrowRight to go forward through page history.
  • Improvements

    • Shortcuts won't trigger while typing in focused text inputs, preventing accidental navigation.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 37319d62-2ba6-44fd-a19d-1f41c6af8368

📥 Commits

Reviewing files that changed from the base of the PR and between 2c9f3d1 and ec6bd74.

📒 Files selected for processing (1)
  • oxide-browser/src/ui.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • oxide-browser/src/ui.rs

📝 Walkthrough

Walkthrough

Keyboard shortcut handling in the UI module now detects Alt+ArrowLeft and Alt+ArrowRight as go_back and go_forward (only when !ctx.wants_keyboard_input()), invoking go_back() or go_forward() on the active tab after existing shortcut processing.

Changes

Cohort / File(s) Summary
Keyboard Navigation Shortcuts
oxide-browser/src/ui.rs
Expanded keyboard shortcut capture to include go_back and go_forward booleans (Alt+ArrowLeft/Alt+ArrowRight) with focus check; added conditional calls to the active tab's go_back() and go_forward() methods after existing shortcut handlers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nibble keys and hop through tabs with glee,
Alt+← and Alt+→, my trail of tea,
Back and forward, I bound and steer,
Small hops, big journeys, the web feels near. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding keyboard shortcuts for navigation (go back and go forward), which directly matches the primary functionality added in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
oxide-browser/src/ui.rs (1)

923-923: Rename go_foward to go_forward for clarity

The typo is harmless functionally, but it hurts readability and makes future maintenance error-prone.

Suggested fix
-            go_foward,
+            go_forward,
@@
-        if go_foward {
+        if go_forward {
             self.tabs[self.active_tab].go_forward();
         }

Also applies to: 965-965

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@oxide-browser/src/ui.rs` at line 923, Rename the misspelled identifier
go_foward to go_forward everywhere it appears (declaration, struct field,
method, and all call sites) to restore clarity; update the occurrences
referenced in this diff (the items at/around the go_foward entries and the other
occurrence noted) and any tests, docs, or pub API that reference it, making sure
to adjust pattern matches, struct initializers, and method definitions to the
new name so the crate compiles after the rename.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@oxide-browser/src/ui.rs`:
- Around line 915-935: The Alt+Arrow navigation booleans (go_back and go_foward)
are being set inside the ctx.input closure and will fire even when a text field
is focused; change the closure so those two values only become true when no
text-editable widget is focused (e.g., check that the input focus is not on an
editable text field via the egui input focus API) before allowing
i.modifiers.alt && i.key_pressed(egui::Key::ArrowLeft/ArrowRight) to set
go_back/go_foward; update the ctx.input closure where new_tab, close_tab,
next_tab, prev_tab, toggle_bookmark, toggle_panel, go_back, go_foward are
computed to add this extra !focused_text_edit condition when assigning go_back
and go_foward.

---

Nitpick comments:
In `@oxide-browser/src/ui.rs`:
- Line 923: Rename the misspelled identifier go_foward to go_forward everywhere
it appears (declaration, struct field, method, and all call sites) to restore
clarity; update the occurrences referenced in this diff (the items at/around the
go_foward entries and the other occurrence noted) and any tests, docs, or pub
API that reference it, making sure to adjust pattern matches, struct
initializers, and method definitions to the new name so the crate compiles after
the rename.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ca6a092-28f5-4097-956f-d5a7d5fef2f9

📥 Commits

Reviewing files that changed from the base of the PR and between 317d869 and 2c9f3d1.

📒 Files selected for processing (1)
  • oxide-browser/src/ui.rs

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant