From 110fe21a2340365b7b7cb72f6f44ad13ed39f4ea Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Mon, 4 Mar 2024 17:31:25 -0700 Subject: [PATCH] fix minor focus issues --- src/engine/entities/FunctionBox.ts | 17 +++++++++++++++-- src/typeshims/rainbowbrackets.d.ts | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 src/typeshims/rainbowbrackets.d.ts diff --git a/src/engine/entities/FunctionBox.ts b/src/engine/entities/FunctionBox.ts index b7015f2..e51eb2b 100644 --- a/src/engine/entities/FunctionBox.ts +++ b/src/engine/entities/FunctionBox.ts @@ -1,4 +1,10 @@ -import { IMAGES, SPRITE_SPECS, SpriteSpec, Sprites } from "../config"; +import { + IMAGES, + Miscellaneous, + SPRITE_SPECS, + SpriteSpec, + Sprites, +} from "../config"; import { Entity, EntityNames } from "."; import { BoundingBox, @@ -77,7 +83,14 @@ export class FunctionBox extends Entity { return; } modalOpen = true; - openModal(this.code); + openModal( + `

${this.code}


`, + ); + + document.getElementById("close")!.addEventListener("click", () => { + closeModal(); + document.getElementById(Miscellaneous.CANVAS_ID)!.focus(); + }); }; this.addComponent(new Interactable(interaction)); diff --git a/src/typeshims/rainbowbrackets.d.ts b/src/typeshims/rainbowbrackets.d.ts new file mode 100644 index 0000000..ac9a2ff --- /dev/null +++ b/src/typeshims/rainbowbrackets.d.ts @@ -0,0 +1 @@ +declare module 'rainbowbrackets';