nextcloud / calendar

📆 Calendar app for Nextcloud
https://apps.nextcloud.com/apps/calendar
GNU Affero General Public License v3.0
986 stars 239 forks source link

Month view scrolls to top when changes are made (new event, event dragged, calendar refreshed, etc.) #3347

Open dominic-p opened 3 years ago

dominic-p commented 3 years ago

Steps to reproduce

  1. Open the Calendar in Month view
  2. Drag an event from one day to another (or turn off the display of a calendar, or create a new event)

Expected behaviour

The window scroll position should not change

Actual behaviour

The window scrolls to the top

Calendar app

Calendar app version: 2.3.1

Nextcloud version: 20.0.11

CalDAV-clients used: NA

Client configuration

Browser: Firefox 90.0.1

Operating system: Windows 10

Browser log

No output during or after drag operation

It's not a huge deal. It's just a bit annoying to have to scroll back down each time I drag something and the window jumps to the top. This may be related to #2967 not sure.

Thanks, as always, for the great software.

dominic-p commented 3 years ago

Actually, this seems to happen anytime a calendar is "refreshed". If you turn off the display of a calendar the windows jumps to the top and when you turn it back on it jumps as well. When you drag a calendar event, the calendar is refreshed, so that seems to be what's triggering this.

GretaD commented 3 years ago

hello @dominic-p, im trying to reproduce this error, but no jump on my side.

ezgif com-gif-maker

can you please send a screenshot of your settings on the calendar

dominic-p commented 3 years ago

Thanks for looking into this. Here are the settings:

calendar

And a quick screencast of the scroll jump. It almost looks like the window is already scrolled to the top in your video?

output

dominic-p commented 3 years ago

@GretaD any luck reproducing this on your end?

GretaD commented 3 years ago

@GretaD any luck reproducing this on your end?

Hey sorry for the late reply, i was on holiday. Will get back to you soon

GretaD commented 3 years ago

I can reproduce it.

dominic-p commented 3 years ago

Awesome! Thanks for working on this. Let me know if there's anything I can do to help at this point.

GretaD commented 3 years ago

Awesome! Thanks for working on this. Let me know if there's anything I can do to help at this point.

Thank you. This is low priority so it might take some time for us to work on it. But if you have development skills, you can have a look and debug it and shoot a PR. Or only debug it and see why this happens, any kind of insight is helpful.

If you need help to set a dev env, let me know.

dominic-p commented 3 years ago

Thanks for the feedback. I can try to take a look. Any advice on where I should start? I'm not familiar with the code base at all right now.

GretaD commented 3 years ago

Thanks for the feedback. I can try to take a look. Any advice on where I should start? I'm not familiar with the code base at all right now.

I would suggest to set up a dev environment according to these steps. theres also this link if you use ubuntu.

and then clone only calendar app. After you have your environment working, you can start testing stuff.

dominic-p commented 3 years ago

Thanks for the tips. I appreciate it.

I guess I was more asking where in the code base you think I should start. Since this is a fairly recent regression, have there been any changes to the month view components that I should look at? It's kind of a tough thing to debug.

GretaD commented 3 years ago

Ah, i see :)

Then maybe have a look at the last release: https://github.com/nextcloud/calendar/releases/tag/v2.3.2 Here are the commits to see what code a certain PR changed: https://github.com/nextcloud/calendar/compare/v2.3.2...master

dominic-p commented 3 years ago

Living with this more, I think I might understand why this is happening. When you make a change (e.g. drag and drop), several of the calendars will refresh. All of the events for each calendar will disappear and then pop back in after the refresh. As each calendar pops back in, scroll jumps up a bit. So, in my original post, I might have just had a day with a lot of events that caused it to jump up all of the way.

Anyway, if I'm right, then maybe a technique like this could solve the problem. The trick would be recognizing when to "remember" the scroll position and when to reload it.