Mottie / Keyboard

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

Class missing for {clear} key #780

Open fbenedetti06 opened 4 years ago

fbenedetti06 commented 4 years ago

Hi, It would seem logical {clear} key have '.ui-keyboard-actionkey' style affected. Many thanks for this so cool keyboard!

Mottie commented 4 years ago

Hi @fbenedetti06!

You can easily modify the keys by using the visible callback (demo)

$(function() {
  $("#keyboard").keyboard({
    layout: "custom",
    customLayout: {
      normal: [
        "` 1 2 3 4 5 6 7 8 9 0 - = {bksp}",
        "{tab} q w e r t y u i o p [ ] \\",
        "a s d f g h j k l ; ' {enter}",
        "{shift} z x c v b n m , . / {shift}",
        "{accept} {space} {clear} {cancel}"
      ],
      shift: [
        "~ ! @ # $ % ^ & * ( ) _ + {bksp}",
        "{tab} Q W E R T Y U I O P { } |",
        'A S D F G H J K L : " {enter}',
        "{shift} Z X C V B N M < > ? {shift}",
        "{accept} {space} {clear} {cancel}"
      ]
    },
    visible: function(e, kb) {
      kb.$keyboard.find(".ui-keyboard-clear").addClass("ui-state-active");
    }
  });
});
fbenedetti06 commented 4 years ago

Thank you for the demo but this is not the goal of my ticket... This is not about 'ui-state-active' class and how to set it in live... I just would warning you that all other action keys have set 'ui-keyboard-actionkey' class except {clear} key! In my mind it was a forgetting you have to correct in futur version. On my side I can live with it...