diff --git a/react/features/base/ui/components/web/Input.tsx b/react/features/base/ui/components/web/Input.tsx index 5b4c804f2c..5613048de0 100644 --- a/react/features/base/ui/components/web/Input.tsx +++ b/react/features/base/ui/components/web/Input.tsx @@ -98,6 +98,9 @@ const useStyles = makeStyles()(theme => { '&.error': { boxShadow: `0px 0px 0px 2px ${theme.palette.textError}` + }, + '&.clearable-input': { + paddingRight: '46px' } }, @@ -121,10 +124,6 @@ const useStyles = makeStyles()(theme => { cursor: 'pointer' }, - clearableInput: { - paddingRight: '46px' - }, - clearButton: { position: 'absolute', right: '16px', @@ -185,6 +184,7 @@ const Input = React.forwardRef(({ }: IProps, ref) => { const { classes: styles, cx } = useStyles(); const isMobile = isMobileBrowser(); + const showClearIcon = clearable && value !== '' && !disabled; const handleChange = useCallback((e: React.ChangeEvent) => onChange?.(e.target.value), []); @@ -211,7 +211,7 @@ const Input = React.forwardRef(({ autoComplete = { autoComplete } autoFocus = { autoFocus } className = { cx(styles.input, isMobile && 'is-mobile', - error && 'error', clearable && styles.clearableInput, icon && 'icon-input') } + error && 'error', showClearIcon && 'clearable-input', icon && 'icon-input') } disabled = { disabled } id = { id } maxLength = { maxLength } @@ -232,7 +232,7 @@ const Input = React.forwardRef(({ autoComplete = { autoComplete } autoFocus = { autoFocus } className = { cx(styles.input, isMobile && 'is-mobile', - error && 'error', clearable && styles.clearableInput, icon && 'icon-input') } + error && 'error', showClearIcon && 'clearable-input', icon && 'icon-input') } data-testid = { testId } disabled = { disabled } id = { id } @@ -252,7 +252,7 @@ const Input = React.forwardRef(({ type = { type } value = { value } /> )} - {clearable && !disabled && value !== '' &&