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.

[Tabs] component reacts to child input's "change" event.

See original GitHub issue
<Tabs onChange={(e) => console.log('change', e)}>
    <Tab label='Tab1' value={'1'}>
        <input />
    </Tab>
    <Tab label='Tab2' value={'2'}></Tab>
</Tabs>

Typing anything into input triggers onChange of Tabs component. Seems like input’s change event bubbles up and gets caught by Tabs.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:10
  • Comments:19 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
navegcommented, Mar 2, 2016

Try giving the input an onChange handler with a stopPropagation call.

handleInputChange(event) {
  event.stopPropagation();
}

<Tabs onChange={(e) => console.log('change', e)}>
    <Tab label='Tab1' value={'1'}>
        <input onChange={handleInputChange} />
    </Tab>
    <Tab label='Tab2' value={'2'}></Tab>
</Tabs>
2reactions
oreqizercommented, May 25, 2016

the problem is also when using Redux Form - then I can’t stop propagation easily

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Tabs] component reacts to child input's "change" event.
Typing anything into input triggers onChange of Tabs component. Seems like input's change event bubbles up and gets caught by Tabs.
Read more >
Passing active tab event to parent and sibling component
The problem with your code is the next lines: toggle = event => { this.setState({ active: event }); this.props.sendEvent(this.state.active); };.
Read more >
TabPanel in a React app - Editor losеs the a value after ...
My problem is: when parent component which contains the tab panel re-rendered, the tab page component loss focus and loss all local state...
Read more >
How to Build a Tabs Component with React
After the project is finished, change into the directory: cd react-tabs-component. Copy. In a new terminal tab or window, start the project ...
Read more >
How to detect when an @Input() value changes in Angular?
We have a component FormComponent (parent) and ChildComponent (child). When the user enters anything in the text input field of the parent ...
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