This project is archived and is in readonly mode.

#456 ✓invalid
Hakan

Backspace not captured by Event.Key on Key Press in Safari 3.1.2

Reported by Hakan | November 2nd, 2008 @ 04:07 AM | in 2.0 (closed)

Gentlemen,

I'm a brand-new convert to MooTools so apologize if the following is an oversight on my part rather than a bug.

Basically, the Event.key property appears not to capture backspace on keyPress in Safari 3.1.2 on my Mac. Please check out attached code. Focus on any of the two input fields and hit Backspace in Safari. It will not be logged to console.

Cheers.

<html> <head>

<!-- MooTools -->

<script src="/assets/scripts/mootools.core.js" type="text/javascript"></script>
<script src="/assets/scripts/mootools.more.js" type="text/javascript"></script>

<!-- This doesn't log backspace in Safari 3.1.2 when you type in either of the inputs -->
<script type="text/javascript">
    window.addEvent('domready', function(){
        ['foo', 'bar'].each(function(item){
            $(item).addEvent('keypress', function(event){
                console.log(event.key);
                event.preventDefault();
            });
        });
    });
</script>

<form>
    <input id="foo" type="text" />
    <br />
    <textarea id="bar"></textarea>
</form>

Comments and changes to this ticket

  • Jan Kassens

    Jan Kassens November 2nd, 2008 @ 08:39 AM

    • Assigned user changed from “Valerio” to “Jan Kassens”
    • State changed from “new” to “hold”

    I'm pretty sure this is nothing we can fix, since addEvent uses the native event listeners in the background (as in any other framework).

    Does it work with your previous framework in Safari 3.1?

  • Daniel Steigerwald

    Daniel Steigerwald November 2nd, 2008 @ 10:59 AM

    Just little helper, but immense useful, to see whats happen on keypress. http://unixpapa.com/js/testkey.html

  • Jan Kassens

    Jan Kassens November 2nd, 2008 @ 01:03 PM

    • State changed from “hold” to “invalid”
    • Tag changed from 3.1.2, event, onkeypress, safari to event, onkeypress, safari

    as seen in daniels link, safari doesnt fire keypress for backspace, i guess theres nothing we can do about that.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages