I came across this problem while developing a sample application. The jsfiddle link which i am sharing have a basic functionality of opening a popup on button click. As rendered function is getting called only once while creation, thus disabling pointermode and spot works first time. But Why every time is it necessary for enyo to disable pointer mode and set spot to the component developer wants.
My requirement is that whenever popup opens a dialog, spotlight should be on the component i have specified. It could be the first component in popup or developer specified I might not be aware of other ways of doing / approaching the same, so please let me know.
Here is the jsfiddle link:
http://jsfiddle.net/pL1cawnw/1/
enyo.kind({
name:'app',
kind:'enyo.Control',
components:[
{name:'popupBtn',kind:'moon.Button', content:'Open', ontap:'btnTapped'},
{name:'popupBtn2',kind:'moon.Button', content:'Dummy'},
{name:'inputPopUp', kind: 'inputPop'}
],
btnTapped:function(){
this.$.inputPopUp.show();
},
rendered: function(){
this.inherited(arguments);
enyo.Spotlight.setPointerMode(false);
enyo.Spotlight.spot(this.$.popupBtn);
}
});
enyo.kind({
name:'inputPop',
kind:'enyo.Popup',
center:true,
scrim:true,
floating:true,
components:[
{name:'inputDecorator', spotlight: true, kind:'moon.InputDecorator', style:'width:200px; height: 80px', components:[
{kind:'moon.Input', name:'input', dismissOnEnter:true}
]}
],
create:function(){
this.inherited(arguments);
},
rendered: function(){
this.inherited(arguments);
enyo.Spotlight.setPointerMode(false);
enyo.Spotlight.spot(this.$.inputDecorator);
}
});
new app().renderInto(document.body);
Apart from this way of doing initial focus, is there any other way of achieving the same?