-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Calendar: manuelInput does not work #3624
Comments
Same. Needed to go back to 3.21.0 for manual input to work. |
Same here too... It was an old 2021 bug. |
@tugcekucukoglu The problem was created in issue #3452. You need to return (add) check |
any update on this? |
It is strange that such important functionality as entering the date in the calendar has not yet been restored. You need to check your demos and the official website that use the latest PrimeVue components and you will find that entering the date anywhere in the calendar view does not work. I can't update PrimeVue components in my projects as the ability to enter a date is an important part of user input. |
Yep, same. Still stuck on 3.21.0 until this gets fixed. |
I am disappointed in this calendar input it is very complicated for no reason |
we have monkey patched this component to make it work this hasn't been super-vetted, it may have other unintended consequences <Calendar
ref="calendarComponentRef"
...
/> /**
* Prevent PrimeVue's Calendar component from stealing focus from its own
* input, preventing users from manually entering dates
*
* see https://github.com/primefaces/primevue/issues/3624
*/
const fixCalendarFocusTrap = () => {
const componentExists = !!calendarComponentRef.value;
if (!componentExists) return;
const alreadyMonkeyPatched =
!!calendarComponentRef.value.originalUpdateFocusFunc;
if (alreadyMonkeyPatched) return;
calendarComponentRef.value.originalUpdateFocusFunc =
calendarComponentRef.value.updateFocus;
calendarComponentRef.value.updateFocus = () => {
const inputEl = calendarComponentRef.value.input;
const inputElHasFocus = inputEl && inputEl == document.activeElement;
if (!inputElHasFocus) {
calendarComponentRef.value.originalUpdateFocusFunc();
}
};
};
watch(calendarComponentRef, () => fixCalendarFocusTrap(), {
immediate: true,
}); |
@mertsincan @tugcekucukoglu |
still in PR with merge conflicts |
The causes of the problem have long been found, and the solution is very simple. MR with conflicts, because the code base has changed and the project developers ignore this issue, despite the fact that they themselves created this bug. |
Please fix this. Using the monkeypatch for now, but that's not a good solution... |
Hello, |
Are there any updates? It still not works in 3.30.2. I stick to version 3.21.0 because of this bug. |
For me solution was, copy all code from primevue node_modules\primevue\calendar\Calendar.vue version 3.21.0, create new component with code from version 3.21.0 and import it im my component Calendar, import CalendarNew from '@shared/components/CalendarNew.vue'. |
Users kept complaining, so I did what @argentines recommended plus added these 3 fixes: I also had to add Here is my CalendarNew.vue component with the modified code: https://pastebin.com/TWyjvVuE 2023-10-09 UPDATE: Added ede8fcd to fix AM/PM issue |
+1 with 3.25.0 |
Issue still exists on latest version (3.32.2) |
Still broken in V3.34.1 |
How the heck does this pass PR all the time as it's still broken. You guys need some QA over there |
Set to be fixed at 3.34.2. So many comments, we must fix it! Sorry for delays, the unstyled mode took majority of focus but we're back to normal maintenance schedule now. |
It's still not fixed in 3.35.0 |
I'm not sure what to do now. It appears that my custom version #3624 (comment) doesn't work with 3.35.0. I am experiencing issue #4451 now. I tried adding the fix mentioned in the post: ...but the AM/PM thing is still happening, which leads me to believe I'm missing some other changes along the way. Regardless, maintaining a compatible custom Calendar component has become undesireable. I think my options are:
Options 1 & 3 aren't ideal for me, and users will complain about options 2 & 3. I suspect I'll have to go with option 2, but if anyone has additional ideas, please share. Thank you. |
For people who cannot upgrade their versions, here's another naive fix. Not sure why it works with seemingly no breaks, but it's good enough for my needs. Use at your own risk. import Calendar from 'primevue/calendar'
import {defineComponent} from 'vue'
export default defineComponent({
extends: Calendar as any,
methods: {
updateFocus: () => {
/* Prevents primevue's default behaviour. */
}
}
}) Just put this in a .ts or .js file & use this instead of the base component. |
Thank you. I'm using v3.29.1 and it works <3 |
The 3.52.0 version has the same error |
Describe the bug
Since version 3.22.0 and also in 3.23.0 the manual input of dates is not possible. It only works for time fields.
Reproducer
https://primevue.org/calendar
PrimeVue version
3.23.0
Vue version
3.x
Language
TypeScript
Build / Runtime
Vue CLI App
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: