sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Use a magnifying glass instead of a text "Go" for the search button

Open timhoffm opened this issue 1 year ago • 8 comments

additionally:

  • Change placeholder text from "Search" to "Search...", which seems more common
  • CSS changes: Use a fixed height to make sure search field and button have the same hight. Also reduce button width a little because the icon needs less space.

Preview: grafik

timhoffm avatar Jul 15 '24 21:07 timhoffm

I would just give some a little more left-padding to the text input cheers

chrisjsewell avatar Jul 15 '24 21:07 chrisjsewell

Whoops. Yes, the padding got lost. Fixed: grafik

timhoffm avatar Jul 15 '24 21:07 timhoffm

Not sure if it's me but... could you vertically center the glass?

picnixz avatar Jul 16 '24 09:07 picnixz

Not sure if it's me but... could you vertically center the glass?

Yeh actually I see that now also 😅

chrisjsewell avatar Jul 16 '24 09:07 chrisjsewell

The text is centered. If I double the height, I get

image

I believe this is an effect how the font renders the glyph: On another system (windows), I get: image

While one could add padding to shift it for a specific font, that might make it worse for other font. I believe one has to live with this. Or do you have an idea?

Edit: I believe we don't want to add fontawesome or some web fonts. One solution might be to embed a svg icon (e.g. https://uxwing.com/search-icon/) but I'm not a HTML expert, so not sure if/how that works.

timhoffm avatar Jul 16 '24 10:07 timhoffm

I don't believe it is feasible to add an SVG icon to the submit button as is. I therefore propose to close because we cannot guarantee reasonable positioning with unicode glyphs.

An alternative route would be an adaption of https://pagedart.com/blog/how-to-add-a-search-bar-in-html/, which for example could be styled like this:

grafik

Or, how Furo, where the looking glass is only decoration and you don't have any button (submit only by enter) grafik

The downside is that this uses other html elements and styling (border runs around the complete form not only the input box, the looking glass is actually the button). Thus customization of downstream themes would be broken. - Likely their CSS just does not have any effect and they would get the default styling we provide. Would that be acceptable?

timhoffm avatar Jul 16 '24 21:07 timhoffm

This is not a release blocker.

AA-Turner avatar Jul 23 '24 21:07 AA-Turner

Moving to draft until a decision is reached on https://github.com/sphinx-doc/sphinx/pull/12590#issuecomment-2231867182

timhoffm avatar Jul 26 '24 01:07 timhoffm