This project is archived and is in readonly mode.

#541 open
Kevin Sweeney

Hide OverText instance when initializing on an input that already has focus

Reported by Kevin Sweeney | March 16th, 2011 @ 09:16 PM | in 1.4.0.1 (closed)

My basic use-case has been as follows:
1. Lightbox class opens a page
2. Page loads, lightbox class gives focus to first text input it finds
3. Page javascript does it's own thing, applying OverText class to input that has focus

Result: The input receives focus, overtext is still visible, even while typing
Expected: Overtext is never shown until input is blurred

I've made the following patch, but not sure if this is the preferred method to solve the issue:

enable: function(){
    this.element.addEvents({
        focus: this.focus,
        blur: this.assert,
        change: this.assert
    });
    window.addEvent('resize', this.reposition);
    this.assert(true);
    this.reposition();
    // start of new code
    if (this.element.match(':focus')) {
        this.hide();
    }
    // end of new code
    return this;
}

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The MooTools Extensions

People watching this ticket

Pages