1
0
mirror of https://github.com/koloml/philomena-tagging-assistant.git synced 2026-05-09 07:12:19 +00:00

Fixed scroll jump when preset becomes hidden

This commit is contained in:
2026-04-05 19:21:09 +04:00
parent 81b3d61a20
commit 7d41524b4a

View File

@@ -196,7 +196,13 @@ export class TagsForm extends BaseComponent {
);
const containerOffsetDifference = this.#presetsList.container.offsetTop - containerOffset;
const presetOffsetDifference = (targetElement?.offsetTop || 0) - presetOffset;
let presetOffsetDifference = (targetElement?.offsetTop || 0) - presetOffset;
// If target element is no longer visible, then there is no need to apply scrolling fix, otherwise it will shift
// user up. Invisible elements are always report 0 offset.
if (targetElement?.checkVisibility() === false) {
presetOffsetDifference = 0;
}
// Compensating for the layout shift: when user clicks on a tag (or on "add/remove all tags"), tag editor might
// overflow the current line and wrap tags around to the next line, causing presets section to shift. We need to