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

AutoComplete does not have a way to programatically set focus #305

Closed
PaulInglis opened this issue Aug 9, 2019 · 4 comments
Closed

AutoComplete does not have a way to programatically set focus #305

PaulInglis opened this issue Aug 9, 2019 · 4 comments
Assignees
Labels
Enhancement New feature of an existing functionality or an improvement of an existing functionality pkg:Dropdowns
Milestone

Comments

@PaulInglis
Copy link

I'm submitting a...

  • Bug report

Current behavior

When programatically setting the focus of to the AutoComplete it appear to have any way to do it, other than clicking or touching on to the field (maybe tabbing too.

Expected behavior

To be able to set the focus via a focus() method

Minimal reproduction of the problem with instructions

I have recreated a working example to show how an in put handles setting focus and then when the same is attempted for an AutoComplete how it fails and causes an error
https://stackblitz.com/edit/react-dqhc9l

What is the motivation or use case for changing the behavior?

I need after a user has entered details into a form for the focus to go back to the autocomplete, so they can continue entering more information, without having to click back to the control. This is essential for rapid, keyboard only data entry

Browser:
any

System:

  • TypeScript version: 3.5.1
  • Node version: 10.16.0
  • Platform: Windows
@vladimirivanoviliev vladimirivanoviliev self-assigned this Aug 10, 2019
@vladimirivanoviliev
Copy link

vladimirivanoviliev commented Aug 13, 2019

We are planning to expose the focusable element of each component on it's ref, however this change is planned for after current release (expected at mid September).

@nstoychev
Copy link

Currently, the autocomplete provides its HTML element and the component can be focused using it:
autocomplete.element.querySelector('input').focus();

After exposing a focusable element, the focusing will be:
autocomplete.focusableElement.focus();

I don't see much difference.

@nstoychev
Copy link

@PaulInglis - Here is how the AutoComplete can be focused programmatically: https://stackblitz.com/edit/react-cjkps6.

@Xizario Xizario added Enhancement New feature of an existing functionality or an improvement of an existing functionality pkg:Dropdowns labels Sep 13, 2019
@vladimirivanoviliev vladimirivanoviliev added this to the 3.7.0 milestone Oct 31, 2019
@vladimirivanoviliev
Copy link

vladimirivanoviliev commented Oct 31, 2019

All form components now have focus method on their ref which can be used for focusing it. Can be checked in latest dev version 3.7.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature of an existing functionality or an improvement of an existing functionality pkg:Dropdowns
Projects
None yet
Development

No branches or pull requests

4 participants