fix(gui): stop renaming a folder from swallowing the click that commits it

The folder's name box commits on blur, and blur fires on the PRESS —
before the click that press belongs to. Committing re-rendered, and the
re-render replaced every tile in the open folder, so by the time the
click was dispatched the tile under the pointer was detached and the
delegated handler never saw it. Typing a name and then tapping an app
in the folder — the path a brand-new folder puts the user on — renamed
the folder and did nothing else; the app only opened on a second click.

Rebuild the folder's contents only when they actually differ from what
is on screen. A rename doesn't change them, so nothing is detached, and
a background refresh no longer throws away hover/focus either. Tiles
that survive get their drag resting-rects cleared, since the card can
have moved under them since the rects were taken.
This commit is contained in:
Nariman Jelveh
2026-08-07 21:22:17 -07:00
parent a3fdd57446
commit f6728619a7
+17 -2
View File
@@ -1421,8 +1421,23 @@ const TabApps = {
'--myapps-group-cols',
String(Math.max(1, Math.min(apps.length, Number.isFinite(maxCols) ? maxCols : 4))),
);
$grid.html(apps.map(app => buildTileHtml(app)).join(''));
$overlay.find('.myapps-tile').attr('tabindex', '0');
const html = apps.map(app => buildTileHtml(app)).join('');
// A rebuild replaces every tile node, and a node detached mid-gesture
// takes the rest of that gesture with it: the name box commits on
// BLUR, which fires on the press — before the click it belongs to —
// so renaming a folder and then clicking an app in it renamed the
// folder and did nothing else (the click found no tile to bubble
// from). Nothing here changes on a rename, so nothing is rebuilt.
if ( $grid[0].__myappsPanelHtml !== html ) {
$grid[0].__myappsPanelHtml = html;
$grid.html(html);
$overlay.find('.myapps-tile').attr('tabindex', '0');
} else {
// Tiles that survive keep the resting rects an earlier drag left
// on them, and the card may have moved since (a resize re-centres
// it) — stale rects are what the next drag would hit-test against.
for ( const el of $grid[0].children ) el.__myappsRestRect = null;
}
this.updateRunningDots($el_window);
},