Email conversation
From | Monte Shaffer |
To | Me |
Subject | Trapping Backspace Key in Mozilla does not function! |
Date | 30 May 2005 03:36 |
http://www.howtocreate.co.uk/tutorials/javascript/important
When I turn on the script, it appears to work okay... to the point
that I grabbed your basic syntax. I am building a javascript word
twist game. The interface is mouse driven, but also has keyboard
commands. And since I hit the "backspace" so often when I program, I
built it in to delete the last selected character.
I notice Mozilla tries to perform the action (like try the space bar)
before executing the "trap."
Thanks in advance.
From | Me |
To | Monte Shaffer |
Subject | Re: Trapping Backspace Key in Mozilla does not function! |
Date | 30 May 2005 23:00 |
Monte,
> I notice Mozilla tries to perform the action (like try the space bar)
> before executing the "trap."
Browsers have their own set of keyboard shortcuts. They can not (or should
not) be interfered with. If you try to disable them (and you will fail), you
will only confuse your users who rely on these shortcuts working. You will
simply have to accept that this key has another function, and your script is
conflicting with it. The best advice I can give is to choose another key
instead of backspace.
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
From | Monte Shaffer |
To | Me |
Subject | Re: Trapping Backspace Key in Mozilla does not function! |
Date | 31 May 2005 01:06 |
I agree with the default shortcut (alt left arrow). However, how am I
supposed to build a web application with a DOM GUI interface if I
can't access the Backspace key, specifically an online typing test.
Talk about confusing the user ::: hit SHIFT-ALT-8 to use backspace in
Mozilla, but in IE just hit the backspace.
I am talking about following DOM standards and event captures. The
backspace key is essential to building an online typing test.
It is a bug in mozilla, and although I try to use it consistently,
such a bug may alter my opinion. IE allows javascript to truly trap
the functions; Mozilla does not. Is Mozilla going to follow DOM and
ECMA standards? That probably is the ultimate question. If not, how
is a web application designer supposed to use the power of DOM to
build universal apps that can run on any browser, any OS?
[URLs]
My typing test I am designing has the option of disabling backspace
during the testing activity.
monte
{x:
From | Me |
To | Monte Shaffer |
Subject | Re: Trapping Backspace Key in Mozilla does not function! |
Date | 31 May 2005 09:43 |
Monte,
> I agree with the default shortcut (alt left arrow).
IE, Opera, Mozilla, Firefox, Safari, Konqueror, OmniWeb all use backspace as
a default shortcut for going back ...
> However, how am I
> supposed to build a web application with a DOM GUI interface if I
> can't access the Backspace key
You can use a textarea instead of a purely DOM GUI interface. Form inputs
are still part of the DOM. Textareas are designed to allow you to input
text, which is exactly what you want. If you avoid using textareas, or other
text editing widgets, you will risk conflicting with the browser's own
keyboard shortcuts. In Opera, you would stand absolutely no chance, as most
keys on the keyboard can function as shortcuts outside of text inputs.
Using a textarea would work consistently in all these browsers. If you don't
want the user to see what they are typing, set the background and text
colour to white.
> It is a bug in mozilla, and although I try to use it consistently,
> such a bug may alter my opinion.
No, absolutely not. The browser still has to be a browser. It still has to
let the user use it the way that they want to use it. Browsers should never
allow a web page to dictate what keys they can or cannot use. If they did,
we would all be stuck with those annoying pages which totally take control
over the browser and force you to kill the task (as several advert pages or
exploits do with IE).
> IE allows javascript to truly trap
> the functions; Mozilla does not. Is Mozilla going to follow DOM and
> ECMA standards?
This has absolutely nothing to do with DOM or ECMA standards. It is about
good user interface. The DOM may allow events like this to be cancelled, but
all that means is that the page may prevent it from being used to interract
with the page, such as in a textarea. It does not mean that it should be
allowed to take control over the user interface.
> That probably is the ultimate question. If not, how
> is a web application designer supposed to use the power of DOM to
> build universal apps that can run on any browser, any OS?
This is really a little bit too theological. Just because a browser is
capable of running a DOM application does not mean it is not a browser any
more. It still is a browser, and it still has to allow the user to use it as
one. The simple answer is that browsers provide certain widgets for certain
types of interraction - form inputs, links, etc for mouse and keyboard
interraction. If you want that type of interraction, use the correct type of
widget.
Tarquin
From | Monte Shaffer |
To | Me |
Subject | Re: Trapping Backspace Key in Mozilla does not function! |
Date | 31 May 2005 17:26 |
Still doesn't answer the overal question. IE let's me trap, mozilla does not.
Thanks for your interest.
monte
{x:
From | Me |
To | Monte Shaffer |
Subject | Re: Trapping Backspace Key in Mozilla does not function! |
Date | 31 May 2005 17:37 |
Monte,
> Still doesn't answer the overal question. IE let's me trap, mozilla does
> not.
It will. In a textarea. Which is where you are supposed to do keyboard
related traps. When the user focuses the textarea, the browser knows they
want the page to be able to use their keystrokes. That will do what you
want.
From | Monte Shaffer |
To | Me |
Subject | Re: Trapping Backspace Key in Mozilla does not function! |
Date | 31 May 2005 20:25 |
Typing with images:
[URL]
And yes, I am working on a browser workaround with a textarea...
defeats the purpose of DOM!
monte
{x: