Skip to content

Commit

Permalink
fix(ui): render div when dSearchable is false
Browse files Browse the repository at this point in the history
  • Loading branch information
xiejay97 committed Feb 22, 2023
1 parent baedaaf commit 84f4189
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions packages/ui/src/components/_selectbox/Selectbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,26 +176,36 @@ export function DSelectbox(props: DSelectboxProps): JSX.Element | null {
return dInputRender(
renderFocusVisible(
renderBaseInput(
<input
ref={combineInputRef}
className={`${prefix}__search`}
style={{
opacity: inputable ? undefined : 0,
zIndex: inputable ? undefined : -1,
}}
type="text"
autoComplete="off"
disabled={dDisabled}
role="combobox"
aria-haspopup="listbox"
aria-expanded={dVisible}
onFocus={() => {
setIsFocus(true);
}}
onBlur={() => {
setIsFocus(false);
}}
/>
React.createElement<any>(
dSearchable ? 'input' : 'div',
Object.assign(
{
ref: combineInputRef,
className: `${prefix}__search`,
style: {
opacity: inputable ? undefined : 0,
zIndex: inputable ? undefined : -1,
},
tabIndex: dDisabled ? -1 : 0,
role: 'combobox',
'aria-haspopup': 'listbox',
'aria-expanded': dVisible,
onFocus: () => {
setIsFocus(true);
},
onBlur: () => {
setIsFocus(false);
},
},
dSearchable
? {
type: 'text',
autoComplete: 'off',
disabled: dDisabled,
}
: {}
)
)
)
)
);
Expand Down

0 comments on commit 84f4189

Please sign in to comment.