Menu

Post image 1
Post image 2
Post image 3
Post image 4
1 / 4
0

“The page jumps up when clicking on buttons in a JavaScript calendar

DEV Community·Samuel Pérez·20 days ago
#PxHnIDAI
Reading 0:00
15s threshold

Samuel Pérez

I'm developing a calendar in vanilla JavaScript connected to a Node.js backend.

I'm having a strange bug on the frontend:

  • When clicking calendar buttons, the page scrolls up,
  • The calendar re-renders after each action,
  • and there seems to be a problem with the DOM scrolling or re-rendering.

The calendar is dynamically rebuilt using:

  • innerHTML
  • createElement
  • XMLHttpRequest

I've already tried:

  • type="button"
  • preventDefault()
  • stopPropagation()

but the problem persists.

Has anyone encountered a similar bug related to re-rendering or scroll position loss?

I've attached a video of the behavior.

Read More