Scroll to top when changing format #2204

Closed
opened 2026-02-05 03:18:30 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @jhrdt on GitHub (Apr 20, 2021).

Context

  • Version: BookStack v21.04
  • System: Windows 10
  • Browser Firefox 78.9.0esr / 88.0

jumping-issue

What have I done

  • Open a new page
  • Add a list on top
  • Add sections and text below
  • Change format of last section (e.g. from small to tiny)

What happened

  • Scrollbar jumps to top position
  • Cursor keeps position

If I remove the list on top, the jumping does not happen.

What do I expected to see

  • Window/Scrollbar position should not change
Originally created by @jhrdt on GitHub (Apr 20, 2021). ## Context * Version: BookStack v21.04 * System: Windows 10 * Browser Firefox 78.9.0esr / 88.0 ![jumping-issue](https://user-images.githubusercontent.com/22557140/115364379-a098df80-a1c3-11eb-919d-ed5bb4570620.gif) ## What have I done * Open a new page * Add a list on top * Add sections and text below * Change format of last section (e.g. from small to tiny) ## What happened * Scrollbar jumps to top position * Cursor keeps position If I remove the list on top, the jumping does not happen. ## What do I expected to see * Window/Scrollbar position should not change
OVERLORD added the 🐛 Bug📝 WYSIWYG Editor💻 Front-End Upstream labels 2026-02-05 03:18:30 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Apr 20, 2021):

Thanks for raising @jhrdt.

Can confirm this, although the exact scenario seems hard to pin-point. Not always when a list is involved, but often requires scroll past a certain point.

Traced it back to this line within the editor: d79205cbe7/src/core/main/ts/focus/EditorFocus.ts (L61)
Think it's essentially default browser behavior coming into play since this occurs on the focus to the body element.
Since TinyMCE 4.x support has ended we might need to fork the project for a while to patch it until we switch out editors.

@ssddanbrown commented on GitHub (Apr 20, 2021): Thanks for raising @jhrdt. Can confirm this, although the exact scenario seems hard to pin-point. Not always when a list is involved, but often requires scroll past a certain point. Traced it back to this line within the editor: https://github.com/tinymce/tinymce/blob/d79205cbe7d9f74e2ca287ee4e7dee3c32138b5b/src/core/main/ts/focus/EditorFocus.ts#L61 Think it's essentially default browser behavior coming into play since this occurs on the focus to the body element. Since TinyMCE 4.x support has ended we might need to fork the project for a while to patch it until we switch out editors.
Author
Owner

@jaypi95 commented on GitHub (Sep 24, 2021):

Has there been some progress on a patch? I have the same issue for quite some time now. Is there anything I do to help solve this problem?

@jaypi95 commented on GitHub (Sep 24, 2021): Has there been some progress on a patch? I have the same issue for quite some time now. Is there anything I do to help solve this problem?
Author
Owner

@IceWreck commented on GitHub (Sep 29, 2021):

I face this when I close the monospace/code editor. (Only in Firefox, Chromium is fine.)

@IceWreck commented on GitHub (Sep 29, 2021): I face this when I close the monospace/code editor. (Only in Firefox, Chromium is fine.)
Author
Owner

@brurnt commented on GitHub (Nov 30, 2021):

@IceWreck @jaypi95 I don't know if you already did this, but you can manually change the javascript code to make it work.

Disclaimer: I didn't test it at all, but if something breaks it's easy to repair (like save an original copy of the file).
Also I am using docker, so paths may vary. I am no expert in coding so you are doing this at your own risk!

Workaround:
Under the directory path something/libs/tinymce/ is the file tinymce.min.js which can also found mentioned in the html header.
Like I said make a copy of that file to have a backup.
Take a text editor and search for

else e.focus()

and replace it with either nothing or

else {}

then save and reload the page.

@brurnt commented on GitHub (Nov 30, 2021): @IceWreck @jaypi95 I don't know if you already did this, but you can manually change the javascript code to make it work. Disclaimer: I didn't test it at all, but if something breaks it's easy to repair (like save an original copy of the file). Also I am using docker, so paths may vary. I am no expert in coding so you are doing this at your own risk! Workaround: Under the directory path _something_/libs/tinymce/ is the file tinymce.min.js which can also found mentioned in the html header. Like I said make a copy of that file to have a backup. Take a text editor and search for ``` else e.focus() ``` and replace it with either nothing or ``` else {} ``` then save and reload the page.
Author
Owner

@mcdannys commented on GitHub (Jan 17, 2022):

I also have this issue on almost any of my pages. I'm on Firefox, Chrome seems fine.

@mcdannys commented on GitHub (Jan 17, 2022): I also have this issue on almost any of my pages. I'm on Firefox, Chrome seems fine.
Author
Owner

@ssddanbrown commented on GitHub (Feb 25, 2022):

Based on changes made to the editor in the development branch in this release cycle, and based on my findings/testing (and due to a change in how we handle end-of-editor spacing) this should be fixed as of the next release (v22.02) so I'll therefore close this off.

@ssddanbrown commented on GitHub (Feb 25, 2022): Based on changes made to the editor in the development branch in this release cycle, and based on my findings/testing (and due to a change in how we handle end-of-editor spacing) this should be fixed as of the next release (v22.02) so I'll therefore close this off.
Author
Owner

@IceWreck commented on GitHub (Feb 25, 2022):

Thanks a lot.

@IceWreck commented on GitHub (Feb 25, 2022): Thanks a lot.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2204