Skip to content

The console command input box loses focus after autocomplete #5

@gianluca-nitti

Description

@gianluca-nitti

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions