mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-27 00:16:44 +00:00
fix(gui): move focus into a folder when it opens
Opening a folder called .focus({ preventScroll: true }) on a jQuery
object. jQuery's .focus() shorthand reads a lone non-function argument
as event DATA and binds a handler with it, so it never moved focus:
the folder opened modal over the grid with focus still on the tile
behind its scrim, where Tab walked away through the inert grid instead
of cycling inside the dialog — and the object it bound as a handler
threw a TypeError on that tile's every subsequent focus.
Focus the DOM node instead, as every other focus call in this file
already does.
This commit is contained in:
@@ -1319,7 +1319,14 @@ const TabApps = {
|
||||
input.focus();
|
||||
input.select();
|
||||
} else {
|
||||
$overlay.find('.myapps-tile').first().focus({ preventScroll: true });
|
||||
// The DOM node, not the jQuery wrapper: jQuery reads a lone
|
||||
// object argument to .focus() as event DATA and binds a handler
|
||||
// with it instead of moving focus — so the folder opened with
|
||||
// focus still on the inert grid behind it (Tab then walked off
|
||||
// through that grid, past this dialog's trap), and the bogus
|
||||
// handler threw on the tile's every later focus.
|
||||
const first = $overlay.find('.myapps-tile')[0];
|
||||
if ( first ) first.focus({ preventScroll: true });
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user