Hallo,

I'm always a little confused with how default behavior of browsers in
case of events is handled. I can always call event.preventDefault()
but somehow it seldomly seems to have any effect.
For example I have a FocusPanel, with some subpanel with some children
which can have a grey selection background. The selection I want to
move with cursors. So I add a KeyDownHandler to FocusPanel, doing
that.
In my Constructor I setFocus(true) and I add a BlurHandler, to set
focus again, if lost (so the FocusPanel has constant focus to handle
the keyevents).
Not the problem is, that if having focus, the FocusPanel has an ugly
border, which the browser generates, I guess. So I want this default
behavior, to put a border around the selected FocusPanel, to stop.

What I tried is to add a FocusHandler to the FocusPanel, and I just
called event.preventDefault() and event.stopPropagation(). To my
intuition, now FocusEvents should be completely consumed by the panel
and the default behavior should not happen.
However this has no effect, the default behavior still takes place, in
Chromium as well as in Firefox.
Does anyone know where my mistake is? I remember always having trouble
with this, I managed something similar just with GWT (no native
Javascript, I avoid that, wherever possible) once, but I just can't
remember how exactly...

Oh, by the way, firefox doesn't react to the setFocus(true) in the
constructor, Chromium does, if anyone knows a solution for that, I'd
be grateful, too ;-)

Many greetings,
Peter

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to