Skip to content
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

fix(Calendar): not trigger onViewDateSelect when input typing #7563

Merged
merged 1 commit into from
Jan 4, 2025

Conversation

KumJungMin
Copy link
Contributor

@KumJungMin KumJungMin commented Jan 4, 2025

Defect Fixes


How to resolve

Cause of the Issue

issue occurred flow (current version)

graph TD
    A[User types in input field] --> B[onUserInput function is triggered]
    B --> C[updateValueOnInput function is triggered]
    C --> D[onViewDateSelect function is triggered]
    D --> E[onSelect function is triggered]
    E --> F["Issue occurred!!"] 
Loading
  • Due to the above flow, when typing in the input field, the onSelect event is triggered, causing a bug.

Proposed Solution

  • To address the issue, the behavior of the onSelect function has been modified so that it is triggered only when the user interacts with the date picker button.
  • However, if the onSelect function is also intended to work while typing in the input field, please leave a comment, and I will update it accordingly.

Test

<Calendar value={date} onChange={(e) => setDate(e.value)} onSelect={(e) => console.log(e.value)} />
2025-01-04.11.17.57.mov

Copy link

vercel bot commented Jan 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Updated (UTC)
primereact ⬜️ Ignored (Inspect) Visit Preview Jan 4, 2025 2:21pm
primereact-v9 ⬜️ Ignored (Inspect) Visit Preview Jan 4, 2025 2:21pm

@KumJungMin KumJungMin changed the title fix(Calendar): not trigger onViewDateSelect when user typing fix(Calendar): not trigger onViewDateSelect when input typing Jan 4, 2025
@melloware
Copy link
Member

Nice it looks like this was introduced in #7155

@melloware melloware merged commit 16eafe5 into primefaces:master Jan 4, 2025
9 checks passed
@KumJungMin KumJungMin deleted the fix/issue-7553 branch January 5, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calendar: onSelect is forcing date while typing
2 participants