At.js icon indicating copy to clipboard operation
At.js copied to clipboard

List filtering on textareas broken with Android KB since 1.4

Open tkalliom opened this issue 7 years ago • 1 comments

With version 1.3.2, At.js textareas work nicely on Android Chrome with the Android keyboard providing suggestions. Entering characters after @ filters the list correctly.

With version 1.4.0–current, entering @ opens up the suggestion list, but any further characters close it. Switching to the “no suggestions” keyboard makes filtering work again.

tkalliom avatar Jul 17 '17 12:07 tkalliom

Hello, i have the solution !

You can take the last version of at.js, the beug is in ligne 380 to 400 :

` // Ligne 380 Controller.prototype.lookUp = function(e) { var query, wait; if (e && e.type === 'click' && !this.getOpt('lookUpOnClick')) { return; }

// The problème it's here !! , in android the composing in some version of android can be call before the keyevent ! this.app.isComposing will be true, and the function is return without call the lookup !!

        if (this.getOpt('suspendOnComposing') && this.app.isComposing) {

// It's returning with nothing

            return;
        }

        query = this.catchQuery(e);
        if (!query) {
            this.expectedQueryCBId = null;
            return query;
        }

// This part of code can't be call with the component return this.app.setContextFor(this.at); if (wait = this.getOpt('delay')) { this._delayLookUp(query, wait); } else { this._lookUp(query); }

        return query;
    };`

For fix this i temporally change the place of the call function for make priority with lookUp :

` Controller.prototype.lookUp = function(e) { var query, wait; if (e && e.type === 'click' && !this.getOpt('lookUpOnClick')) { return; }

        query = this.catchQuery(e);
        if (!query) {
            this.expectedQueryCBId = null;
            return query;
        }
        this.app.setContextFor(this.at);
        if (wait = this.getOpt('delay')) {
            this._delayLookUp(query, wait);
        } else {
            this._lookUp(query);
        }

        /* edit kevin lourenco : */
        if (this.getOpt('suspendOnComposing') && this.app.isComposing) {
            return;
        }

        return query;
    };

`

Just easy like this ! But if there is a best solution, i don't say no :)

This code fix all version of android.

kevinlourenco avatar Oct 03 '17 16:10 kevinlourenco