mlajtos / mosaic

A tiling web browser.
MIT License
106 stars 4 forks source link

Finding a text in the page #8

Closed mlajtos closed 4 years ago

mlajtos commented 4 years ago

Motivation

Finding specific text in the page is a must-have feature. Without it, one can't use Mosaic on a daily basis, hence can't take advantage of the tiling in every situation.

Design

Proposal A

Search bar for a specific text in a page can be integrated into the omnibar. !bangs are an extremely good abstraction for the search queries, and searching text in a page fits this category. Having a !page or !inpage pseudo bang would trigger a special mode for omnibar (or toolbar) that would add necessary buttons (previous match, next match).

Proposal B

Copy and refine existing design from prior art.

Prior art

Firefox

Searchbar takes full width of the view below the website.

disabling-Firefox-find-bar-page-dimming-and-highlight-all-features (source: https://techdows.com/2016/09/disable-firefox-find-bar-page-dimming-highlight-all-features.html)

Safari

Search bar takes full width of the view and pushes the website down.

Find_on_page_bar_and_matches_on_safari_browser_mac_computer (source: https://browserhow.com/how-to-search-text-and-find-on-page-in-safari-mac/)

Chrome

Search bar is compact and floating above the page.

browser-will-find-this-word-on-page (source: https://rocketfiles.com/articles/how-to-search-for-a-word-on-a-web-page-chrome)

Vivaldi

Search bar takes whole width of the view and is aligned to the center.

Find-in-Page-example

(source: https://rocketfiles.com/articles/how-to-search-for-a-word-on-a-web-page-chrome)

Relevant documentation

marc2332 commented 4 years ago

I am working on this in https://github.com/marc2332/mosaic.

So far:

Result:

imagen

imagen

Ideas:

Note: I have never used recoil, but I am trying my best šŸ‘šŸ»

michalklempa commented 4 years ago

May I suggest some key binding to 'jump to next search result' and 'jump to previous?', what are the usual bindings on these (not n and N as in less :D)

marc2332 commented 4 years ago

Yep!

In Firefox these shortcuts are (pretty bad in my opinion): Ctrl+G -> Next result Shift F3 -> Previous result

I would definitely use ones more friendly, specially for the 'previous' one. And also add some Up and Down arrows to do the same

mlajtos commented 4 years ago

Hey @marc2332,

I tried your Find in Page implementation and it works quite okay. Go ahead and make a PR.

Don't worry about Recoil.js, I jumped on it because I wanted to try out something new, so we are in the same boat being beginners. šŸ™‚ So far I can see it has shortcomings (especially for this project šŸ˜…), but I hope they will be worked out as we go further.

About keybindings ā€“ I use Enter for next and Shift-Enter for previous. These only makes sense. At least for me.

Btw nice touch adding animation. šŸ™‚

marc2332 commented 4 years ago

The PR is https://github.com/mlajtos/mosaic/pull/12 Feel free to review it ^^

mlajtos commented 4 years ago

Fixed by #14