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

Resizing page with fullCalendar shortcode and a different view resets the main calendar #536

Open
zachflauaus opened this issue Jun 13, 2023 · 0 comments

Comments

@zachflauaus
Copy link

I've recently discovered a bug where if a page is using the eo_fullcalendar shortcode, has different view options available, and the user has selected a non-default view, the calendar will reset to the default view that is set. For example, if the page is using the following shortcode:

[eo_fullcalendar headerLeft='today,prev,next' headerCenter='prev,title,next' headerRight='month,agendaWeek,agendaDay']

The calendar's default view will be the month grid view. But if the user selects the Week or Day view and resizes the window, the calendar will reset back to the month view. This was discovered because our custom theme uses a Javascript library that fires event listeners for the resize event to determine if the navigation bar should stick to the top of the window based on the height. Here's a screen recording of the issue:

Event.Organiser.-.View.Toggle.Issues.mp4

I've also created a demo site with a page that uses the view options and has the bug and one that doesn't use the view options and does not have the bug.

It seems like this is caused by the frontend.js file on line 281:

windowResize: function(view) {
    if( view.calendar.options.responsive && $(window).width() < view.calendar.options.responsiveBreakpoint ){
        $(this).fullCalendar( 'changeView', _eoResponsiveViewMap[view.calendar.options.previousView] );
    } else {
        $(this).fullCalendar( 'changeView', view.calendar.options.previousView );
    }
},

Removing the else condition fixes that bug and allows the calendar to go into the responsive list view but it then breaks in the opposite direction and does not change the responsive list view into the grid view when the window is larger than the responsive breakpoint. I could also be totally off base and the issue could also lie in the fullCalendar library itself. If I can provide any other information or help, let me know. 👍


Tested with:

  • WordPress 6.2.2
  • Twenty Twenty-three v1.1 (and additional custom themes)
  • Event Organiser v3.12.3
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

No branches or pull requests

1 participant