From a7cb2c0b22f03b79f19d4a9a2eb691d1ccc392f9 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 14 Mar 2012 18:04:11 -0700 Subject: adding a focus manager to handle panel bugs where blur was not getting called when clicking on the canvas. Signed-off-by: Valerio Virgillito --- js/components/focus-manager.reel/focus-manager.js | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 js/components/focus-manager.reel/focus-manager.js (limited to 'js/components/focus-manager.reel') diff --git a/js/components/focus-manager.reel/focus-manager.js b/js/components/focus-manager.reel/focus-manager.js new file mode 100644 index 00000000..65a84bc1 --- /dev/null +++ b/js/components/focus-manager.reel/focus-manager.js @@ -0,0 +1,49 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +exports.FocusManager = Montage.create(Component, { + + hasTemplate: { + value: false + }, + + element: { + serializable: true, + enumerable: true, + get: function() { + return this._element; + }, + set: function(value) { + // call super set + Object.getPropertyDescriptor(Component, "element").set.call(this, value); + } + }, + + hiddenInput: { + value: null + }, + + prepareForDraw: { + value: function() { + this.hiddenInput = document.createElement("input"); + this.hiddenInput.type = "text"; + + this.element.appendChild(this.hiddenInput); + + } + }, + + setFocus: { + value: function() { + this.hiddenInput.focus(); + } + } + +}); + -- cgit v1.2.3