Skip to content

Commit

Permalink
fix(@clayui/color-picker): fix error of "hidden" input add extra margin
Browse files Browse the repository at this point in the history
  • Loading branch information
matuzalemsteles committed Jul 22, 2021
1 parent d8251c4 commit f4d8aa0
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions packages/clay-color-picker/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,6 @@ const ClayColorPicker: React.FunctionComponent<IProps> = ({
return (
<FocusScope arrowKeysUpDown={false}>
<div className="clay-color-picker">
{name && (
<input
name={name}
onChange={(e) =>
useNative ? onValueChange(e.target.value) : null
}
ref={valueInputRef}
style={{
height: 0,
margin: 0,
padding: 0,
visibility: 'hidden',
width: 0,
}}
type={useNative ? 'color' : 'text'}
value={value ? `${isHex ? '#' : ''}${value}` : ''}
/>
)}

{title && <label>{title}</label>}

<ClayInput.Group
Expand All @@ -224,6 +205,29 @@ const ClayColorPicker: React.FunctionComponent<IProps> = ({
small={small}
>
<ClayInput.GroupItem prepend={showHex} shrink>
{name && (
<input
name={name}
onChange={(e) =>
useNative
? onValueChange(e.target.value)
: null
}
ref={valueInputRef}
style={{
height: 0,
position: 'absolute',
visibility: 'hidden',
width: 0,
}}
tabIndex={-1}
type={useNative ? 'color' : 'text'}
value={
value ? `${isHex ? '#' : ''}${value}` : ''
}
/>
)}

<ClayInput.GroupText>
<Splotch
aria-label={ariaLabels.selectColor}
Expand Down

0 comments on commit f4d8aa0

Please sign in to comment.