Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text search widget finds its own contents #65

Open
erkyrath opened this issue Jun 23, 2016 · 0 comments
Open

Text search widget finds its own contents #65

erkyrath opened this issue Jun 23, 2016 · 0 comments

Comments

@erkyrath
Copy link
Owner

When you do a text search, the input in the text widget gets highlighted yellow, indicating that the search has found that text.

We try to disguise this fact: if you're searching forward or backward, it skips over the text widget. (You can see it flicker by if you watch.)

I spent a few days trying to fix this, and wound up with nothing but toothmarks on my knee.

First I put the search widget in the shadow DOM. You'd think that would help, but it turns out that webContents.findInPage searches the shadow DOM as well as the main DOM! This behavior is inherited from Chromium and perhaps Webkit. (See electron/electron#6138 , https://bugs.chromium.org/p/chromium/issues/detail?id=621403 .)

Then I went down the alley of putting the search widget into a webview tag. This worked, but it felt pretty bad. The webview is a third process (which cannot communicate with the main process, only with the window renderer?) so we have a two-step relay for shoving information back and forth. Also, I don't understand the flexbox layout of the webview; I had to hardcode box sizes. Also, I couldn't get the input widget to grab focus from the main page.

So I backed the webview stuff out.

I've got the shadow DOM implementation now, mostly because I didn't have the energy to back that out too. Maybe someday it will start working.

(And then I'll have to delete the skip-over-last hack. Just nuke the found-in-page handler from main.js.)

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

No branches or pull requests

1 participant