On Mon, 02 Dec 2013 11:42:30 -0000, Mounir Lamouri <[email protected]> wrote:

Hi,

I am not sure that telling the webpage what the user is currently trying
to search is a great idea. However, if a webpage wants its own "find in
page" UI I guess a simple solution would be to do something similar to
the Forms Validation UI: a 'findinpage' event could be fired on the
document when the user initiates a find in page and the page would be
able to call .preventDefault() on the event in order to show its own UI.

It could look like:
window.document.addEventListener('findinpage', function(e) {
  e.preventDefault();
  var find = createFindInPageUI();
  find.focus();
});

Would that work with OS X's Find Pasteboard?

In OS X I can press Cmd+E in any application to choose selected text as the search keyword and Cmd+G in any other application to search for that text. This allows me to search pages in browser without ever invoking "find in page" explicitly in the browser.

I suggest having non-cancellable event that merely informs the page what user is searching for. The event could be populated from any UI, e.g. typical find-in-page dialog/toolbar, from search pasteboard or voice command.

Then pages like Google Docs could do:

window.document.addEventListener('find', function(event) {
        editedDocument.showPagesContaining(event.findInPageQueryAsRegEx);
});

I'm not sure if there needs to be a way for the page to respond when it's ready — it might be enough if browsers just react to dynamic DOM changes.


Otherwise I'm afraid that sites will start hijacking browser's find-in-page UI to provide their "enhanced" version that doesn't match platform's conventions and lacks functionality.

--
regards, Kornel

Reply via email to