I made custom component like this:
my.Cmp = function(opt_domHelper) {
goog.ui.Component.call(this, opt_domHelper);
...
};
goog.inherits(my.Stamina, goog.ui.Component);
my.Cmp.prototype.createDom = function() {
this.decorateInternal(this.dom_.createDom('div', 'сmp-inner-div'));
};
my.Cmp.prototype.decorateInternal = function(element) {
my.Cmp.superClass_.decorateInternal.call(this, element);
var elem = this.getElement();
...
};
my.Cmp.prototype.disposeInternal = function() {
my.Stamina.superClass_.disposeInternal.call(this);
...
};
my.Cmp.prototype.enterDocument = function() {
...
}
my.Cmp.prototype.exitDocument = function() {
...
}
Then I created an instance in html document
var cmp = new my.Cmp();
cmp.render(goog.dom.getElement('cmpContainerDivId'));
This component uses keyboard. It gets keyboard focus after mouse click and works fine. I can’t find how to give kb focus after page load. I tried to inherit my.Cmp component from goog.ui.Control and to use it’s setFocused method. getState() shows that focus in set, but no reaction on kb typing before mouse click or tab key pressed.
Presumably, with the following:
setFocused()seems to exist mostly for bookkeeping, for things likeisFocused()and similar state methods.