Skip to content

Searchbox: Clicking in front of input text puts cursor at the start of the text#4587

Merged
lynamemi merged 5 commits intomicrosoft:masterfrom
lynamemi:searchbox-focus
Apr 18, 2018
Merged

Searchbox: Clicking in front of input text puts cursor at the start of the text#4587
lynamemi merged 5 commits intomicrosoft:masterfrom
lynamemi:searchbox-focus

Conversation

@lynamemi
Copy link
Copy Markdown
Collaborator

@lynamemi lynamemi commented Apr 17, 2018

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ npm run change

Description of changes

We received feedback from one of our partners that after entering text in the search input field, it's hard to get the cursor back to the beginning of the text.

To solve this, any clicks on the element before the input field move the cursor to the beginning of the text.

searchboxfocus

Focus areas to test

(optional)

@lynamemi lynamemi requested a review from micahgodbolt April 17, 2018 18:28
@manishgarg1
Copy link
Copy Markdown
Collaborator

@micahgodbolt, can you please review this. I am not able to conclude if this the best way to make this fix.

@lynamemi
Copy link
Copy Markdown
Collaborator Author

Me neither! Definitely open to alternatives for making it easier to position the cursor at the start.

@micahgodbolt
Copy link
Copy Markdown
Member

what if that was put onto the icon 'onClick'. i.e. after you mouse away from search the icon comes back....there's a TON of space to click....but it doesn't do anything. You even get an I beam to as cursor.

probably change it to an icon button with onClick handler.

@lynamemi
Copy link
Copy Markdown
Collaborator Author

@micahgodbolt I explored putting the onClick on the Icon and on an IconButton. I landed on keeping the onClick handler on the icon container. See new gif above in description and reasoning below:

Icon: I found that by putting the onclick on the icon container, instead of the Icon, this allows the text cursor to move seamlessly between the icon area and text. Giving only the icon the click creates a break in experience.

IconButton: I tried plugging in an IconButton in place of the Icon, but there will be a lot of different interactive states that we would need to override. I figure if we can avoid that, that would be good.

@micahgodbolt
Copy link
Copy Markdown
Member

@lynamemi ok good, that's perfect. I think I misunderstood your original intention. I'm glad that clicking inside of the input captures that onClick. I was afraid that ANY click would send you to the beginning. This works great.

@lynamemi
Copy link
Copy Markdown
Collaborator Author

Ok cool! Glad we're on the same page!

@lynamemi lynamemi merged commit 5f6ae67 into microsoft:master Apr 18, 2018
@lynamemi lynamemi deleted the searchbox-focus branch April 18, 2018 20:11
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants