-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Search result corrupts HTML page #34
Comments
I have debugged a little and noticed that you catch the messages in
receives cleanup message when you type some search string but nothing arrives on Esc, despite you send the clean. |
The easiest solution that worked for me was to
where clear() is
start using it whenever you need |
The working alternative that would automatically clean the search one popup closed is to use a timer instead of the Close button. You send the ping messages periodically from popup.js to the content.js. When "search" is received, content.js starts a timer, which runs clear() on timeout. The timer is restarted on arrival of ping. This will postpone the clean until popup is really closed. Content.js will detect this by the timeout monitor and clean up the search. I did, it, works. |
So when the search bar is focused and I hit Esc, the search clears as expected. When I click the "Next" button and then hit escape, only the popup closes, and the search stays. I think the solution here would just be to add a keypress handler on both buttons that clears when Esc is pressed. |
At first, it is false. I hit enter to search, focus stays in the input input. I also mouse click there to ensure that and hit Esc. Only popup but no search results disappear. My observation that popup closes unpredictably, when I am debugging the esc event in the popup window, suggests that there is a race condition. It is just Chrome design. Chrome closes your popup whenever another window gets the focus. In this light, when you cannot even ensure proper cleanup when user clicks your beloved Esc, your desire to catch all close events with the Esc or Next key down looks funny. The only reliable keydown design is a special Close button that will both clear the result and close the popup window. I find it however more practical to clear by ping timeout eventhough, theoretically, under high loads, ping msg may be delayed by more that 500 ms in the presence of active popup. |
If we decide to clear the search on any close of the popup, then we should probably do something like this. |
This is actually the workaround that I used. My timeout solution uses both polling (ping) and ports (send message). |
You revoke the corruption when search text changes and Esc pressed. But, Esc pressing just closes the popup and does not revoke the match results in my case. I have to enter some text into the search bar to remove it before closing.
The text was updated successfully, but these errors were encountered: