A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(ui): a control hidden while focused loses focus, preventing a ghost click
esengined136e349c81b
diff --git a/sdk/src/ui/input/focus.ts b/sdk/src/ui/input/focus.tsindex 2f0110c0b..f60c6cc41 100644--- a/sdk/src/ui/input/focus.ts+++ b/sdk/src/ui/input/focus.ts@@ -65,6 +65,11 @@ export class FocusPlugin implements Plugin {(input: InputState, events: UIEventQueue) => {if (focusManager.focusedEntity !== null && !world.valid(focusManager.focusedEntity)) {focusManager.focusedEntity = null;+ } else if (focusManager.focusedEntity !== null && hiddenInTree(focusManager.focusedEntity)) {+ // A focused control hidden out from under us (e.g. a dialog closed+ // by its own Confirm button) must lose focus, or a later Enter/Space+ // would re-fire Click on the now-invisible control.+ clearFocus();}const focusableEntities = world.getEntitiesWithComponents([Focusable]);