Skip to content

Conversation

@areibman
Copy link
Owner

@areibman areibman commented Oct 14, 2025

Fixes #32

Co-authored-by: meta.alex.r <meta.alex.r@gmail.com>
@areibman areibman linked an issue Oct 14, 2025 that may be closed by this pull request
11 tasks
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines +159 to +184
// Enable native find-in-page functionality with keyboard shortcuts
let findActive = false;

mainWindow.webContents.on("before-input-event", (event, input) => {
// Handle Cmd/Ctrl+F to start find
if (input.type === "keyDown" && input.key === "f" && (input.control || input.meta)) {
event.preventDefault();
// Start find with empty string to show the find interface
mainWindow?.webContents.findInPage("");
findActive = true;
}
// Handle Escape to stop find
else if (input.type === "keyDown" && input.key === "Escape" && findActive) {
event.preventDefault();
mainWindow?.webContents.stopFindInPage("clearSelection");
findActive = false;
}
// Handle Enter for find next (when find is active)
else if (input.type === "keyDown" && input.key === "Enter" && findActive && !input.shift) {
event.preventDefault();
mainWindow?.webContents.findInPage("", { forward: true, findNext: true });
}
// Handle Shift+Enter for find previous (when find is active)
else if (input.type === "keyDown" && input.key === "Enter" && findActive && input.shift) {
event.preventDefault();
mainWindow?.webContents.findInPage("", { forward: false, findNext: true });

Choose a reason for hiding this comment

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

P1 Badge Find shortcut never gathers search text and hijacks Enter

The new before-input-event handler sets findActive on every Cmd/Ctrl+F and then preventDefaults any subsequent Enter press while findActive is true, routing it to webContents.findInPage("", {findNext:true}). Electron does not show a native find UI and an empty string uses the previous selection, so most users never enter a search term and nothing is found. After a single Ctrl+F, the window effectively loses all Enter behaviour (e.g. submitting forms or triggering buttons) until Escape is pressed, because the handler intercepts the key even though no search is in progress. The feature therefore both fails to provide “find in page” and breaks normal keyboard interaction.

Useful? React with 👍 / 👎.

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.

Bug: Enable native Electron find-in-page (Cmd/Ctrl+F) functionality

3 participants