question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] [2020.04] TextInput onChange lose focus

See original GitHub issue

After upgrade when the value change the textInput lost focus, it seems that is rendering again the component in onChange event. (See Gif)

Component

<TextInput
                value={this.state.addEgressHost.host}
                type="text"
                id="addEgressHost"
                key="addEgressHost"
                aria-describedby="add egress host"
                name="addHost"
                onChange={this.onAddHost}
                isValid={this.state.validEgressHost}
              />

OnAddHost method

  onAddHost = (value: string, _) => {
    const host = value.trim();
    this.setState({
      addEgressHost: {
        host: host
      },
      validEgressHost: isServerHostValid(host)
    });
  };

GIF

ezgif-4-5a5a26e8e121

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
redallencommented, Apr 20, 2020

I’m investigating this now and it seems to be a problem on any <input> element inside of a table row. It also appears to occur on "@patternfly/react-table": "2.24.41" which is what kiali is using. Will update once I find a fix…

1reaction
aljesusgcommented, Apr 16, 2020

Ok @redallen let me do some research. Thanks !!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

In React ES6, why does the input field lose focus after typing a ...
When your onChange event fires, the callback calls setState with the new title value, which gets passed to your text field as a...
Read more >
React Text Input Losing Focus After Each Keypress
React Text Input Losing Focus After Each Keypress. This bug took me a while to figure out, so I thought I would share...
Read more >
[v6] fields losing focus after first onChange #1094 - GitHub
The losing focus bug is not a bug. It's the expected React behavior. If you are defining your component as an arrow function...
Read more >
Gallery Fields Lose Focus OnChange
The problem is when tabbing or clicking to the next field, the OnChange fires and the field loses focus.
Read more >
[Fix Input Popup Losing Focus] I don't understand what ...
Hey Leonardo, I assume this is a known issue with Outsystems and this module is a workaround?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found