Re: Keydoard handling - who has the focus?

Hello.

Being able to set a keyboard listener to DIV is great. However, if the DIV
doesn't have focus() method, will it get the event after all (once when the
even interface has been defined)? That is, will a DOM implementation be
required to deliver onKeyClick (or something similar) to the DIV even if
there are no descendants of it that are of INPUT type="TEXT" defined for
the DIV?

Thank you very much

     Boris Motik




                                                                                                                   
                    keshlam@us.ib                                                                                  
                    m.com                To:     Boris.Motik@trilogy.com                                           
                                         cc:                                                                       
                    26.06.2000           Subject:     Re: Keydoard handling - who has the focus?                   
                    14:58                                                                                          
                                                                                                                   
                                                                                                                   



>In DOM L2 only INPUT elements can have focus. They have the focus() method
>which makes them receive input.

The focus() method you're mentioning is defined only in the HTML DOM. And I
believe its behavior was taken pretty directly from the constraints of HTML
4.0. One way to step out from under it might be to process your document
using an XML DOM.

Note that DOM Level 2 doesn't define keyboard events at all; they were
deferred pending input from the I18N and WAI Working Groups.  Also note
that the DOM Level 2 Events module doesn't have any concept of focus;
that's dealt with outside the DOM and affects which node the event is
dispatched to.

Of course you could also set a keyboard-event listener on your DIV node and
either capture the events before they reach the DIV's descendents, or
respond after they've bubbled upward (assuming that the inner elements
haven't cancelled the event before bubbling reaches the DIV).


______________________________________
Joe Kesselman  / IBM Research

Received on Monday, 26 June 2000 20:54:43 UTC