AidanZealley / off.canvas

Off canvas style HTML, CSS and javascript framework
147 stars 24 forks source link

arrow keys on form pages #10

Open mwendell opened 10 years ago

mwendell commented 10 years ago

Hello,

I noticed that when enableKeys is true, I can no longer use the arrow keys within form fields. I'm not sure if you've addressed this, but it was causing a problem with our users. I fixed the issue by making the following modifications to jquery.offcanvas.js (beginning around line 134)

if (settings.enableKeys) {
    $(this).keydown(function(e) {
        if (!$('input').is(':focus')) {
            /* snipped for brevity */
        }
    });
}

This seems to be working fine, although I have no idea if it's the best way to do it or not.

We only have inputs, and no textareas, so this is enough for us, but I'd imagine adding textareas would be helpful for most people as well.

Thanks! m.

mwendell commented 9 years ago

Ahhh... we've added a textarea to our site, requiring the following change:

if ((!$('input').is(':focus')) && (!$('textarea').is(':focus'))) {
     /* snipped for brevity */
}

It would be great if these changes could be integrated somehow, possibly in the settings. I think most developers would agree that it's pretty important that arrow keys continue to work as expected within form fields.

Thanks, m.