PDA

View Full Version : disableFocus() - IE issue helper



Choleriker
22 Oct 2007, 3:18 AM
Hello,

i have input-fields in cards. When im switching between the cards and an input is focused in an hidden card, ie letz blink the cursor over the actual card. For this i have written an helper, which focuses an input field which isnt in view-port.

This only works in an layout without a page scrollbar.



Ext.disableFocus = function() {
if(!Ext.isIE) return;
var f = Ext.get('disable-focus-input');
if(!f) {
f = Ext.DomHelper.append(document.body, {
tag:'input', style:'position:absolute;top:-1000;left:-1000;'
}, true);
}
f.dom.focus();
};

DigitalSkyline
22 Oct 2007, 10:09 AM
Good idea.. I wonder if it would work if you put focus on an input type image? Haven't tried this, just a thought...

Choleriker
29 Oct 2007, 12:01 AM
Good idea.. I wonder if it would work if you put focus on an input type image? Haven't tried this, just a thought...

Why image? tag:'input' is set on auto-creation of the DomHelper.

DigitalSkyline
29 Oct 2007, 9:25 PM
I was thinking that since the input type of image there would be no cursor and you could render it hidden within the viewport... again I don't know if this would work.

Choleriker
30 Oct 2007, 2:57 AM
IE will trigger an error when setting the focus to a hidden input field.

DigitalSkyline
30 Oct 2007, 10:01 AM
What if it was a 1X1 transparrent gif? I'm just wondering, I know this cursor showing through layers is annoying, I have it happening too in my CMS app.

Choleriker
5 Dec 2007, 2:17 AM
What if it was a 1X1 transparrent gif?

Dunno, never tried it.