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.

AutoComplete onKeyPress does not work

See original GitHub issue

The onKeyPress seems to be missing on the AutoComplete. It works on the Input. I’m not sure if this is an issue with 2.5.0, i think it should have worked previously. We need this event to check for special keys.

@connect((state, props) => ({ item: state.elements[props.id] }))
export default class ConsoleElement extends React.PureComponent {
    handleChange = value => this.props.dispatch(actions.update(this.props.id, { value }))
    handleKeyPress = event =>this.props.dispatch(actions.event(this.props.id, event))
    render() {
        let { value, children } = this.props.item;
        return (
            <AutoComplete
                ref="input"
                placeholder="Just type ..."
                style={{ ...this.props.style }}
                value={value}
                dataSource={children}
                onChange={this.handleChange} onKeyPress={this.handleKeyPress} />
        )
    }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
benjycuicommented, Dec 1, 2016

@afc163 组件间的关系应该可以梳理一下,概念上,所有表单类组件都是 Input 的子类,所以基础的 API 应该都有。

现在使用了 TypeScript,所以我们可以定义 interface Input,并要求其他表单类组件都继承这个接口。

Popover Popconfirm Tooltip 也是类似的关系。

0reactions
lock[bot]commented, May 2, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't get autocomplete to work on first keypress - Stack Overflow
This initializes the Autocomplete when the page is ready. When the User enters a keystroke, then it is run, the default min length...
Read more >
keypress on autocomplete is not firing why? - CodeProject
You need to change your keypress to either keydown or keyup and see if it works. If you absolutely have to change autocomplete,...
Read more >
Keypress event doesn't work on textbox if AutoComplete set ...
The event doesn't even fire. It just highlights the text in the TextBox. By all rights it should "Stop" every time I press...
Read more >
Javascript onkeypress event not working in webviewer
Hello, in the code below I have an HTML input which should accept only numbers. The functionality works in Chrome and Edge browsers, ......
Read more >
[Solved]-onKeyPress event do not work if a textbox in form has ...
[Solved]-onKeyPress event do not work if a textbox in form has autocomplete?-winforms c# ... In your application you should not use form events...
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