Skip to content

Commit 673341f

Browse files
committed
Fix #5196
1 parent 7e79109 commit 673341f

File tree

1 file changed

+8
-14
lines changed
  • src/shared/components/GUIKit/DropdownTerms

1 file changed

+8
-14
lines changed

src/shared/components/GUIKit/DropdownTerms/index.jsx

+8-14
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,12 @@ function DropdownTerms({
3333
let inputField;
3434
useEffect(() => {
3535
const selectInput = containerRef.current.getElementsByClassName('Select-input');
36-
const selectMenuOuter = containerRef.current.getElementsByClassName('Select-menu-outer');
3736
if (selectInput && selectInput.length) {
38-
const selectControl = containerRef.current.getElementsByClassName(
39-
'Select-control',
40-
);
41-
const height1 = selectMenuOuter && selectMenuOuter.length
42-
? selectMenuOuter[0].offsetHeight
43-
: 0;
44-
const height2 = selectControl && selectControl.length
45-
? selectControl[0].offsetHeight
46-
: 0;
47-
selectInput[0].style.top = focused ? `${height1 + height2 - 1}px` : '0';
4837
inputField = selectInput[0].getElementsByTagName('input');
4938
inputField[0].placeholder = focused ? addNewOptionPlaceholder : '';
5039
inputField[0].style.border = 'none';
5140
inputField[0].style.boxShadow = 'none';
41+
selectInput[0].style.borderTop = 'none';
5242
}
5343
}, [focused, selectedOption]);
5444

@@ -145,9 +135,13 @@ function DropdownTerms({
145135
backspaceRemoves={false}
146136
multi
147137
promptTextCreator={() => null}
148-
filterOptions={() => _.filter(
149-
internalTerms, t => !_.find(selectedOption, { label: t.label }),
150-
).map(o => ({ value: o.label, label: o.label }))}
138+
filterOptions={(option, inputValue) => _.filter(
139+
internalTerms,
140+
t => (inputValue && inputValue.length >= 2
141+
? t.label.toLowerCase().includes(inputValue.toLowerCase())
142+
&& !_.find(selectedOption, { label: t.label })
143+
: !_.find(selectedOption, { label: t.label })),
144+
)}
151145
/>
152146
<img width="15" height="9" styleName="iconDropdown" src={iconDown} alt="dropdown-arrow-icon" />
153147
</div>

0 commit comments

Comments
 (0)