From f651c20a6c4953a2f837005a214f4ff9eb94c260 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 1 Jan 2025 11:42:14 +0800 Subject: [PATCH] bugfix --- bricks/keypress.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bricks/keypress.js b/bricks/keypress.js index 90b19ef..4931d3b 100644 --- a/bricks/keypress.js +++ b/bricks/keypress.js @@ -1,12 +1,13 @@ var bricks = window.bricks || {}; -bricks.KeyTest = class extends bricks.VBox { +bricks.KeyPress = class extends bricks.VBox { constructor(opts){ super(opts); bricks.app.bind('keydown', this.key_handler.bind(this)); } key_handler(event){ var key = event.key; + if (!key) return; this.clear_widgets(); var w = new bricks.Text({text:'key press is:' + key}); this.add_widget(w)