-
Notifications
You must be signed in to change notification settings - Fork 683
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
[FEATURE] When clicking on the search icon button, focus the search input #1019
[FEATURE] When clicking on the search icon button, focus the search input #1019
Conversation
Added 'outline:none' property.
This pull request is automatically deployed with Now. |
…ame_appears_#1018
Added 'outline:none' property for all buttons, and removed property from searchTrigger.
packages/venia-concept/src/index.css
Outdated
@@ -99,6 +99,7 @@ button { | |||
padding: 0; | |||
touch-action: manipulation; | |||
user-select: none; | |||
outline: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is considered a bad practice to remove the outline from an active element (http://www.outlinenone.com/).
I would start by asking why the outline on the button feels wrong.
Perhaps, the search button should move the focus to the input when the button is tapped?
Or the style of the outline does not meet the expectations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@belbiy good remark, thank you. I read the article you provided and I agree with you that the outline should be left on the desktop, but do we need it on mobile devices?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also seems to me that we need to move the focus after we have clicked on the active element. For example: Click on the search element, and after, the focus is transferred to the input field to search.
Or, if you use only "Tab", the items will stand out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, read the next article: Removing that ugly :focus ring (and keeping it too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DmitryShmaliuk, we cant just remove the focus ring for mobile. There's an interesting prototype for input modality that handles the keyboard-mouse input switching.
But in reality, i think that we can improve user experience greatly by doing simple things first:
-
For search button, move the focus to the input field, so the user does not need to make extra tap. Consider the same behavior for every button – tapping a button can move focus the the area that button controls. If the button opens a shopping cart, for example, move focus inside that modal, etc. This can be a feature of the modal component actually, receiving focus on open, possibly even "trapping" the focus inside itself until closed.
-
Styling the
:focus
state of the buttons and other active elements that they look consistent and not "weird" when focused.
@soumya-ashok, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@belbiy Agree with your feedback. I'd just be cautious with choosing the default focus area in a scenario like the cart where there are multiple focusable elements and there aren't traditional form fields in the same way search or checkout has. We should choose a default that causes the least friction for the user in this scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@belbiy, i agree with you, and i will try to implement the your points.
Implemented focus for input after click on search button.
…lemented focus for input after click on search button.
…018' of github.com:DmitryShmaliuk/pwa-studio into BUG_When_clicking_on_the_search_icon_a_frame_appears_#1018
Attempt to specify a problem with 'build-deploy' test.
…ame_appears_#1018
…ame_appears_#1018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Description
Focus the search field when the search button is clicked.
Related Issue
Closes #1018.
Motivation and Context
When clicking the search button icon the field was not focused.
How Has This Been Tested?
The behavior of the item has been tested on the PC as well as on mobile devices.
Screenshots
Proposed Labels for Change Type/Package
BUG, pkg:venia-concept
Checklist: