Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
ChangeEvent,
Dispatch,
FC,
FocusEvent,
MouseEvent,
MutableRefObject,
ReactNode,
Expand Down Expand Up @@ -83,13 +84,19 @@ const InputSelect: FC<InputSelectProps> = (props: InputSelectProps) => {
className={styles['select-input-wrapper']}
hideInlineErrors={props.hideInlineErrors}
ref={triggerRef}
forceFocusStyle={menuIsVisible}
>
<button
tabIndex={props.tabIndex}
className={styles.selected}
onClick={toggleIfNotDisabled}
type='button'
disabled={!!props.disabled}
onFocus={function onFocus(event: FocusEvent<HTMLButtonElement> | undefined) {
event?.stopPropagation()
event?.preventDefault()
setMenuIsVisible(true)
}}
>
<span className='body-small'>{selectedOption ? label(selectedOption) : ''}</span>
<span className='body-small'>{!selectedOption && !!props.placeholder ? props.placeholder : ''}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface InputWrapperProps {
readonly label: string | JSX.Element
readonly tabIndex?: number
readonly type: 'checkbox' | 'password' | 'rating' | 'text' | 'textarea'
readonly forceFocusStyle?: boolean
}

const InputWrapper: ForwardRefExoticComponent<InputWrapperProps & { ref?: React.Ref<HTMLDivElement> }>
Expand All @@ -43,6 +44,9 @@ const InputWrapper: ForwardRefExoticComponent<InputWrapperProps & { ref?: React.
focusStyle,
showError ? styles['input-error'] : undefined,
props.className,
{
[styles.focus]: props.forceFocusStyle,
},
)

const renderCheckboxLabel: () => JSX.Element | boolean = () => props.type === 'checkbox' && (
Expand Down