mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-26 16:07:13 +00:00
fix(gui): keep a folder name typed right up to the moment it closes
The name box commits on blur, and every exit that goes through a pointer blurs it while the folder is still open — so clicking outside, or launching an app from inside, keeps what was typed. Escape does not: _closeGroup clears _openGroupId first and only then moves focus to the tile below (or removes the card outright), so the blur arrives with no open folder to rename and _renameGroup drops it. A brand-new folder opens with its name selected for exactly this edit, so "type Games, press Escape" — the obvious way to dismiss a dialog — was the path most likely to lose it. Commit the pending name on the way out, before the folder id is gone.
This commit is contained in:
@@ -1450,6 +1450,16 @@ const TabApps = {
|
||||
const groupId = this._openGroupId;
|
||||
if ( ! groupId ) return;
|
||||
this._openGroupId = null;
|
||||
// Commit a name still being typed. Every other way out of the folder
|
||||
// (clicking outside it, launching an app from it) commits through the
|
||||
// box's own blur while the folder is still open; closing is the one
|
||||
// path that blurs it AFTER — handing focus back to the tile below, or
|
||||
// simply removing the card — so the blur handler would find no open
|
||||
// folder to rename and the typed name would be dropped on the floor.
|
||||
const nameEl = $el_window.find('.myapps-group-name')[0];
|
||||
if ( nameEl && document.activeElement === nameEl ) {
|
||||
this._renameGroup($el_window, groupId, nameEl.value);
|
||||
}
|
||||
clearTimeout(this._createdGroupTimer);
|
||||
if ( this._groupEscHandler ) {
|
||||
document.removeEventListener('keydown', this._groupEscHandler);
|
||||
|
||||
Reference in New Issue
Block a user