Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Cannot select via click if rendered item is an imported Component. #365

Open
@agonsalves

Description

@agonsalves

If I set the "renderItem" prop to be a component that has been imported, then clicking on the items in the menu does not trigger the onSelect method. The items also do not get isHighlighted on mouse over. Navigating by keyboard does work.

<Autocomplete
                autoHighlight={false}
                className={className}
                getItemValue={item => item.id}
                items={options}
                name={name}
                onChange={this.handleChange}
                onSelect={this.handleSelection}
                renderItem={(item, isHighlighted) =>
                    <DatalistItem
                        key={Math.random()}
                        item={item}
                        isHighlighted={isHighlighted}
                    />
                }
            />
class DatalistItem extends PureComponent {
    render() {
        const {item, isHighlighted} = this.props
        return (
            <DivContainer
                className={isHighlighted ? 'active' : ''}
                children={item.title}
            />
        )
    }
}

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