• Resolved scienceofspock

    (@scienceofspock)


    Your plugin has a bug when using the delete key. If you type 5 letters using the keyboard, and then hit delete 6 times, it will “store” the last delete and move the cursor to the left when you start typing again, so if I type “sport” followed by 6 delete presses, then type “sport” again, it actually shows “ports”. The more delete keys you press, the more it affects the subsequent output.
    To fix it, you just need to check that the length of the field is not 0:

    del: function() {
    var a = jsKeyboard.currentElement.val();
    if ( a.length > 0 ) {
    var pos = jsKeyboard.currentElementCursorPosition;
    var output = [a.slice(0, pos – 1), a.slice(pos)].join(”);
    jsKeyboard.currentElement.val(output);
    jsKeyboard.currentElementCursorPosition–; //-1 cursor
    jsKeyboard.updateCursor();
    }
    },

    https://wordpress.org/plugins/on-screen-keyboard/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Delete bug’ is closed to new replies.