Mottie / Keyboard

Virtual Keyboard using jQuery ~
http://mottie.github.io/Keyboard/
Other
1.78k stars 723 forks source link

Skip specific inputs #764

Open cc-ben opened 4 years ago

cc-ben commented 4 years ago

Hi @Mottie , i wonder if there is a possibility to skip specific input fields for the prev/next option. Specifically i want to not select type="checkbox" at all. Currently i go with this code

$('input:not(:checkbox, :radio), textarea')
    .keyboard({
        useCombos: true,
        customLayout: {
            'normal': [
                'q w e r t z u i o p ü ß {bksp} {cancel}',
                'a s d f g h j k l ö ä {enter}',
                '{s} y x c v b n m , . {s}',
                '{meta1} {space} _ - {prev} {next}'
            ],
            'shift': [
                'Q W E R T Z U I O P Ü ẞ {bksp} {cancel}',
                'A S D F G H J K L Ö Ä {enter}',
                '{s} Y X C V B N M , . {s}',
                '{meta1} {space} _ - {prev} {next}'
            ],
            'meta1': [
                '1 2 3 4 5 6 7 8 9 0 {empty} {empty} {bksp} {cancel}',
                '` | { } % ^ * / \' @ {empty} {enter}',
                '{meta2} $ & ~ # = + . {meta2}',
                '{normal} {space} ! ? {prev} {next}'
            ],
            'meta2': [
                '[ ] { } \u2039 \u203a ^ * " , {empty} {empty} {bksp} {cancel}',
                '\\ | / < > $ \u00a3 \u00a5 \u2022 {empty} {empty} {enter}',
                '{meta1} \u20ac & ~ # = + . {meta1}',
                '{normal} {space} ! ? {prev} {next}'
            ]
        },
        display: {
            del: '\u2326:Delete',
            redo: '↻',
            undo: '↺',
            'prev': "\u2b06",
            'next': "\u2b07",
            'bksp': "\u2190",
            'accept': 'Speichern',
            'normal': 'ABC',
            'meta1': '.?123',
            'meta2': '#+=',
            'cancel': 'X:Close (Esc)'
        },
        visible: function (event, keyboard, el) {
            var keyboardHeight = $('.ui-keyboard').innerHeight();
            $('body').css('padding-bottom', keyboardHeight);
        },
        beforeClose: function (event, keyboard, el) {
            var keyboardHeight = $('.ui-keyboard').innerHeight();
            $('body').css('padding-bottom', '0');
        },
    })
    .addTyping();

Kind regards, Ben

Mottie commented 4 years ago

Hi @cc-ben!

Maybe you can use the switchInput callback to alter that behavior?