Tasks jump 5px up/left when clicking the menu icon and reloading

Created on 25 July 2025, 9 days ago

Problem/Motivation

In the Template Builder, every time I click the Menu icon for a task, the next time I reload the page that task has jumped 5px up and left, and I have to drag it back to the correct position.

Steps to reproduce

  • Line up some tasks neatly in a grid
  • Reload the page to clear any state
  • Click the menu icon for any task
  • Reload the page again
  • The task is no longer lined up

Proposed resolution

In template-display.js, this.attrs.x/y refer to the icon position (at least initially), not the task position. There is already code to set parent correctly, so I have adapted it to also set a new variable self. (Maybe it could be better named, but I'm not familiar enough with the code.)

The if could easily be changed to while if it were necessary to support more deeply nested elements, though it doesn't seem to be currently.

The patch also includes some code cleanup (remove these if you prefer):

  • Changed var parent = [] to var parent = {} to show it's an object not an array (though technically just var parent; would be fine as it is always overwritten before it is read - same for the other local variables)
  • divtop and divleft were unused, so removed
  • The x and y variables seem unnecessary, so removed

Tested (before and after) in Firefox and Chrome.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

4.1

Component

Code

Created by

🇬🇧United Kingdom mi-dave Oxford, England

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mi-dave
  • 🇨🇦Canada _randy

    Much thanks for the patch mi-dave, however, I have an alternate patch for this that's probably much simpler.

    Give the attached patch a go as it removes any additional complexity.
    The simplest solution is to give the hamburger menu and its bounding box IDs and check for those IDs as to not trigger a move.

    Just as an FYI: I have in the pipeline a revamped Template editor that is a complete rewrite of the drag and drop interface. So I'd rather go with a simpler patch to fix the existing editor. Let me know your thoughts and if the alternate patch works for you.

  • 🇬🇧United Kingdom mi-dave Oxford, England

    Thanks Randy, that makes sense. Patch works for me.

    Look forward to trying the new interface. :)

    Dave

Production build 0.71.5 2024