Skip to content

Commit

Permalink
fix: ColorPicker HEX input cursor jump bug (ant-design#44137)
Browse files Browse the repository at this point in the history
* fix(color-picker): when inputting in the HEX,if you input a lowercase letter,the cursor will jump to the tail,and me fixed it.

* test: fix ColorPicker snapshot

---------

Co-authored-by: afc163 <afc163@gmail.com>
  • Loading branch information
gouge666 and afc163 authored Aug 16, 2023
1 parent a92a883 commit 9ba9da2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ Array [
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -680,7 +680,7 @@ Array [
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -1066,7 +1066,7 @@ exports[`renders components/color-picker/demo/change-completed.tsx extend contex
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -1450,7 +1450,7 @@ Array [
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -1839,7 +1839,7 @@ Array [
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -2202,7 +2202,7 @@ Array [
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -2530,7 +2530,7 @@ exports[`renders components/color-picker/demo/format.tsx extend context correctl
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -4222,7 +4222,7 @@ exports[`renders components/color-picker/demo/panel-render.tsx extend context co
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -5055,7 +5055,7 @@ exports[`renders components/color-picker/demo/panel-render.tsx extend context co
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -5446,7 +5446,7 @@ Array [
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -6207,7 +6207,7 @@ exports[`renders components/color-picker/demo/pure-panel.tsx extend context corr
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -6605,7 +6605,7 @@ exports[`renders components/color-picker/demo/size.tsx extend context correctly
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -6987,7 +6987,7 @@ exports[`renders components/color-picker/demo/size.tsx extend context correctly
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -7368,7 +7368,7 @@ exports[`renders components/color-picker/demo/size.tsx extend context correctly
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -7763,7 +7763,7 @@ exports[`renders components/color-picker/demo/size.tsx extend context correctly
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -8150,7 +8150,7 @@ exports[`renders components/color-picker/demo/size.tsx extend context correctly
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -8536,7 +8536,7 @@ exports[`renders components/color-picker/demo/size.tsx extend context correctly
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -8934,7 +8934,7 @@ exports[`renders components/color-picker/demo/text-render.tsx extend context cor
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -9323,7 +9323,7 @@ exports[`renders components/color-picker/demo/text-render.tsx extend context cor
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -9728,7 +9728,7 @@ exports[`renders components/color-picker/demo/text-render.tsx extend context cor
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -10110,7 +10110,7 @@ Array [
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -10494,7 +10494,7 @@ Array [
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ exports[`ColorPicker Should panelRender work 1`] = `
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down Expand Up @@ -505,7 +505,7 @@ exports[`ColorPicker Should panelRender work 2`] = `
<input
class="ant-input ant-input-sm"
type="text"
value="1677FF"
value="1677ff"
/>
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/color-picker/components/ColorHexInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ColorHexInput: FC<ColorHexInputProps> = ({ prefixCls, value, onChange }) =
return (
<Input
className={colorHexInputPrefixCls}
value={hexValue?.toUpperCase()}
value={hexValue}
prefix="#"
onChange={handleHexChange}
size="small"
Expand Down
1 change: 1 addition & 0 deletions components/color-picker/style/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const genInputStyle: GenerateStyle<ColorPickerToken, CSSObject> = (token) => {
padding: `0 ${paddingXS}px`,
[`${antCls}-input`]: {
fontSize: fontSizeSM,
textTransform: 'uppercase',
lineHeight: `${controlHeightSM - 2 * lineWidth}px`,
},
[`${antCls}-input-prefix`]: {
Expand Down

0 comments on commit 9ba9da2

Please sign in to comment.