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

The console command input box loses focus after autocomplete #5

Open
gianluca-nitti opened this issue Jun 2, 2018 · 0 comments
Open

Comments

@gianluca-nitti
Copy link
Member

gianluca-nitti commented Jun 2, 2018

What the title says.

Command autocompletion, introduced in #4, works, however when the Tab key is pressed the command is completed, but the input box also loses focus, so you have to click it before being able to either type more characters or have the autocomplete engine cycle over the other possible completions.

I did some attempts to fix this on branch commandFocusExperiments, but without success so far.
In commit 972fe02 I managed to get a reference to the TextInput object using the ref attribute in the render code; using Chrome debugger's breakpoints I can see the call to focus on line 25 is executed, however it seem to have no effect. I think that there is either something else gaining focus after that call, or ReactXP's focus function is not correctly implemented.

Some possibly useful links:

  • https://stackoverflow.com/a/28890330 - suggested me how to get the reference to the TextInput
  • https://stackoverflow.com/a/40433391 - at the beginning of this answer it's pointed out that if there are no more elements to focus in the web page, the focus goes to the browser's address bar, and seems like you can't get it back via scripts at this point. I added another TextInput to temporarily circumvent this issue but still the command input box doesn't retain focus, so this probably isn't our main problem right now.

An option could also be producing a minimal example of this behavior and requesting support to the ReactXP developers (via issues or chat), however maybe it's better to check if we are using the latest ReactXP version (and updating it if not) before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant