A "restore focus after remount" flag was armed on every edge gesture but cleared only when a remount really happened. A no-op gesture at the boundary left it armed, so a later remount stole keyboard focus.
Arm a one-shot flag only when the action it waits for really happens. Set on intent, cleared on effect, it leaks across every no-op.
Test the boundary where the action is a no-op.
Test the boundary where the action is a no-op.