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

Enhance search bar UX #83

Merged
merged 3 commits into from
Jun 9, 2022
Merged

Enhance search bar UX #83

merged 3 commits into from
Jun 9, 2022

Conversation

renintw
Copy link
Contributor

@renintw renintw commented Jun 6, 2022

This PR makes three simple changes to the search bar UX mentioned here.

  1. Make the Search Icon aligned with the global menu icon direction.
  2. Make the focus state clear - the input ends before the icon.
  3. Change the placeholder from Search ... to Search in Code Reference ....

As to how to make the search button in the search bar more obvious, since we might be able to just use the search on top of the handbook sidebar (comment) or just move the search bar control into the site-title (PR), I think it isn't worth spending time for the moment to figure out whether to implement any of the proposals or just remove the whole search bar.

Screenshots

Before After
image image

How to test

  1. Go to any API detail page.
  2. Click Search Icon
  3. Check if the Search Icon Direction, Focus state, and Placeholder are correct.

@renintw renintw added the ui label Jun 6, 2022
@renintw renintw self-assigned this Jun 6, 2022
@tellyworth
Copy link
Contributor

Looks good to me!

Comment on lines 204 to 203
-moz-transform: scale(-1, 1);
-webkit-transform: scale(-1, 1);
-o-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which browsers need these prefixes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://caniuse.com/?search=transform
There are about 0.91% of users in total globally still using older browsers needing these prefixes, I used to just add these prefixes, but maybe it's not a good practice, should I just remove them?

(Just found that -o- is used for Opera 11.5 and no one is using that version anymore, I'm going to remove it first)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally speaking we've followed the @wordpress/browserslist-config for which browsers to support.

Browser List
and_chr 101
android 101
chrome 101
chrome 100
chrome 99
edge 101
edge 100
firefox 100
firefox 99
ios_saf 15.4
ios_saf 15.2-15.3
ios_saf 14.5-14.8
op_mini all
opera 86
opera 85
safari 15.5
safari 15.4
samsung 16.0

The only one on this list that doesn't support unprefixed transform is Opera Mini, but it doesn't support transform at all, so we should be okay to drop the prefixes. In the past we've had people flag issues in older browsers (WordPress/wporg-mu-plugins#159), so I'd also check the support for Chrome 87 and make sure it's not broken, at least. But we're fine with unprefixed transform here, too 👍🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the insight sharing!
I've removed them and also tested it on Chrome 87, it looks good 👍
Screen Capture on 2022-06-07 at 23-24-56

Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a few issues:

  1. There's an underline under the search button — this is Mac/Firefox
    underline
  2. The input has a focus style, but the search button also needs one — in this screenshot I'm focused on the button, but there's no indicator.
    no-focus
  3. The search bar overlaps the icon on smaller screens, for example at 500px:
    500-w

@StevenDufresne
Copy link
Contributor

@renintw Just as an FYI: I am working on an alternate approach where the search bar moves to match other wordpress.org themes: #75. It's an experiment so it may not take but I would love it if you could take a look and let me know what you think!

@renintw renintw force-pushed the enhance/search-bar-ux branch 4 times, most recently from f7ec437 to 7b95af1 Compare June 7, 2022 14:59
@renintw
Copy link
Contributor Author

renintw commented Jun 7, 2022

I found a few issues:

  1. There's an underline under the search button — this is Mac/Firefox
    underline
  2. The input has a focus style, but the search button also needs one — in this screenshot I'm focused on the button, but there's no indicator.
    no-focus
  3. The search bar overlaps the icon on smaller screens, for example at 500px:
    500-w

Thanks for catching the issue on Firefox and on smaller screens, I've fixed them in the commit: Fix incorrect style, could you help review them again, thanks!
And after the review, I'll rebase it to the earlier commit.

Tested on Firefox and chrome as well as on different screen sizes: https://d.pr/i/rb0Nt2

@renintw renintw force-pushed the enhance/search-bar-ux branch from 7b95af1 to 837e8c1 Compare June 7, 2022 15:56
border-left: unset;
margin: 0;

&:active {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
&:active {
&:focus {

The keyboard focus state is controlled with :focus. You can test this by using your keyboard, click into the search bar, then hit tab. It will move you to the button, but there's no visual indicator in the PR currently.

Copy link
Contributor Author

@renintw renintw Jun 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing it out!

Done Fixing and also changing the active style to the one like the search bar in the pattern-directory.
image


&:active {
outline-style: auto;
outline-color: rgb(0, 95, 204);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this color come from? Maybe instead, try one of the colors in this list to keep the palette consistent. Like this:

Suggested change
outline-color: rgb(0, 95, 204);
outline-color: get-color(blue-60);

Copy link
Contributor Author

@renintw renintw Jun 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it from Chrome devTools directly.
image

the colors in this list to keep the palette consistent

I like the idea, thanks for sharing it! 👍 However, after applying it, I found the color is a bit different in Chrome (it's hard to tell without zooming in or looking carefully into it though), and it's somehow the same in Firefox. I think I'll change it to use get-color here anyway as it seems to me it's just a slight difference.
image

Done Changing.

@renintw renintw force-pushed the enhance/search-bar-ux branch 2 times, most recently from 32b487c to 6a18eb1 Compare June 8, 2022 15:14
@ryelle ryelle self-requested a review June 8, 2022 19:44
Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great now! Thanks for iterating on it :)

@renintw renintw force-pushed the enhance/search-bar-ux branch from 6a18eb1 to 30d5117 Compare June 9, 2022 02:58
@renintw renintw force-pushed the enhance/search-bar-ux branch from 30d5117 to 7685b63 Compare June 9, 2022 03:00
@renintw renintw merged commit 863f11f into trunk Jun 9, 2022
@renintw renintw deleted the enhance/search-bar-ux branch June 9, 2022 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants