diff --git a/bricks/layout.js b/bricks/layout.js index 51d1cdf..d7d5307 100755 --- a/bricks/layout.js +++ b/bricks/layout.js @@ -12,7 +12,7 @@ bricks.Layout = class extends bricks.JsWidget { this.key_select_items = this.children; } enable_key_select(){ - if (!this.keyselectable) return; + this.keyselectable = true; this.set_key_select_items(); this.selected_children = null; bricks.app.bind('keydown', this.key_handler.bind(this)); @@ -25,9 +25,9 @@ bricks.Layout = class extends bricks.JsWidget { return bricks.key_selectable_stack[p] == this; } disable_key_select(){ - if (!this.keyselectable) return; + this.keyselectable = false; + bricks.app.unbind('keydown', this.key_handler.bind(this)); if (this.is_currkeyselectable()){ - bricks.app.unbind('keydown', this.key_handler.bind(this)); this.select_item.selected(false); this.select_item = null; bricks.key_selectable_stack.pop(); @@ -35,7 +35,8 @@ bricks.Layout = class extends bricks.JsWidget { return; } select_item(w){ - if (!this.keyselectable) return; + if (!w) return; + // if (!this.keyselectable) return; if (this.selected_item){ this.selected_item.selected(false); } diff --git a/bricks/toolbar.js b/bricks/toolbar.js index 03a8abc..d8e1e70 100755 --- a/bricks/toolbar.js +++ b/bricks/toolbar.js @@ -26,6 +26,7 @@ bricks.Toolbar = class extends bricks.Layout { this.bar = new bricks.HScrollPanel(options); this.dom_element.classList.add('htoolbar') } + this.bar.enable_key_select() this.add_widget(this.bar); this.clicked_btn = null; this.preffix_css = this.opts.css || 'toolbar';