I have implemented a react semantic ui dropdown in a react application which is searchable. The dropdown works fine if a select any item by clicking on it. But when I select the element by search text in the drop down the element matching the search text gets the class as active
and the element at the index position of that element get the class set as selected
, where as the expected behaviour is that the element with the matching text should only get both the classes active
and selected
.
JS:
import React from "react";
import { Dropdown } from "semantic-ui-react";
const countryOptions = [
{ key: "af", value: "af", flag: "af", text: "Afghanistan" },
{ key: "ax", value: "ax", flag: "ax", text: "Aland Islands" },
{ key: "al", value: "al", flag: "al", text: "Albania" },
{ key: "dz", value: "dz", flag: "dz", text: "Algeria" },
{ key: "as", value: "as", flag: "as", text: "American Samoa" }
];
const DropdownExampleSearchSelection = () => (
<Dropdown
search
options={countryOptions}
open
scrolling
tabIndex={-1}
wrapSelection={true}
/>
);
export default DropdownExampleSearchSelection;
HTML :
<div id="root"></div>
Expected code snippet :semantic-ui-example-zd7h6