Skip to content

Commit 84f4189

Browse files
committed
fix(ui): render div when dSearchable is false
1 parent baedaaf commit 84f4189

1 file changed

Lines changed: 30 additions & 20 deletions

File tree

packages/ui/src/components/_selectbox/Selectbox.tsx

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -176,26 +176,36 @@ export function DSelectbox(props: DSelectboxProps): JSX.Element | null {
176176
return dInputRender(
177177
renderFocusVisible(
178178
renderBaseInput(
179-
<input
180-
ref={combineInputRef}
181-
className={`${prefix}__search`}
182-
style={{
183-
opacity: inputable ? undefined : 0,
184-
zIndex: inputable ? undefined : -1,
185-
}}
186-
type="text"
187-
autoComplete="off"
188-
disabled={dDisabled}
189-
role="combobox"
190-
aria-haspopup="listbox"
191-
aria-expanded={dVisible}
192-
onFocus={() => {
193-
setIsFocus(true);
194-
}}
195-
onBlur={() => {
196-
setIsFocus(false);
197-
}}
198-
/>
179+
React.createElement<any>(
180+
dSearchable ? 'input' : 'div',
181+
Object.assign(
182+
{
183+
ref: combineInputRef,
184+
className: `${prefix}__search`,
185+
style: {
186+
opacity: inputable ? undefined : 0,
187+
zIndex: inputable ? undefined : -1,
188+
},
189+
tabIndex: dDisabled ? -1 : 0,
190+
role: 'combobox',
191+
'aria-haspopup': 'listbox',
192+
'aria-expanded': dVisible,
193+
onFocus: () => {
194+
setIsFocus(true);
195+
},
196+
onBlur: () => {
197+
setIsFocus(false);
198+
},
199+
},
200+
dSearchable
201+
? {
202+
type: 'text',
203+
autoComplete: 'off',
204+
disabled: dDisabled,
205+
}
206+
: {}
207+
)
208+
)
199209
)
200210
)
201211
);

0 commit comments

Comments
 (0)