-
-
Notifications
You must be signed in to change notification settings - Fork 338
fix: holding left click breaks mask #959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
663937f
fde8fad
5b1a920
d7a17cd
caa9ce8
d87b9d1
b8bb7e1
8079b67
3db54d4
ccd4c43
d3c0f5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -334,16 +334,21 @@ const Input = React.forwardRef<InputRef, InputProps>((props, ref) => { | |
| const rafRef = React.useRef<number>(); | ||
|
|
||
| useLayoutEffect(() => { | ||
| if (!focused || !format || mouseDownRef.current) { | ||
| if (!focused || !format) { | ||
| return; | ||
| } | ||
|
|
||
| // Reset with format if not match | ||
| // Reset with format if not match (always apply when focused so mask works when focusing by mousedown) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里和下面没有还原呀…………
另外,CI 还是失败的哈~ https://github.com/react-component/picker/actions/runs/22935988370/job/66567899243?pr=959
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just updated, please re-run CI
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if (!maskFormat.match(inputValue)) { | ||
| triggerInputChange(format); | ||
| return; | ||
| } | ||
|
|
||
| // When mousedown get focus, defer selection to mouseUp so click position is used | ||
| if (mouseDownRef.current) { | ||
| return; | ||
| } | ||
|
|
||
| // Match the selection range | ||
| inputRef.current.setSelectionRange(selectionStart, selectionEnd); | ||
|
|
||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.