mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-25 23:46:51 +00:00
fix(gui): keep Enter in a folder's name box from leaving the folder
Committing the name with Enter blurred the box, which left focus on <body> — outside a dialog that is marked aria-modal and that traps Tab on its own subtree. The next Tab therefore walked off through the inert grid the folder is covering, exactly what the trap exists to prevent. Step out onto the folder's first app instead; the same blur still commits the name. The keystroke is stopped at the box because the grid's document-level key handler reads Enter on a focused tile as "launch it", and would otherwise have taken the focus move as its cue to open an app the user never asked for.
This commit is contained in:
@@ -1380,7 +1380,19 @@ const TabApps = {
|
||||
$name.on('keydown', function (e) {
|
||||
if ( e.key === 'Enter' ) {
|
||||
e.preventDefault();
|
||||
this.blur();
|
||||
// The name box owns this Enter: the grid's document-level key
|
||||
// handler reads Enter on a focused tile as "launch it", and
|
||||
// the focus move below would hand it exactly that — the same
|
||||
// keystroke would name the folder AND open an app out of it.
|
||||
e.stopPropagation();
|
||||
// Step out onto the folder's contents rather than just
|
||||
// blurring: a bare blur leaves focus on <body>, outside this
|
||||
// dialog, where the next Tab walks off into the inert grid
|
||||
// the folder is covering. Moving focus still commits the
|
||||
// name — that is the same blur.
|
||||
const first = $overlay.find('.myapps-group-panel-grid .myapps-tile')[0];
|
||||
if ( first ) first.focus({ preventScroll: true });
|
||||
else this.blur();
|
||||
}
|
||||
});
|
||||
$name.on('change blur', function () {
|
||||
|
||||
Reference in New Issue
Block a user