[PATCH] accesskey attribute (#45788)

Lubos Lunak l.lunak at suse.cz
Fri Jan 23 16:04:32 GMT 2004


On Friday 23 of January 2004 01:59, Dirk Mueller wrote:
> On Thursday 22 January 2004 13:44, Lubos Lunak wrote:
> >  please review the attached khtml.patch for adding support for the
> > accesskey attribute. I based the searching and focusing code on the one
> > used for tabbing to next element, so I hope I got it right.
>
> the html_inlineimpl patch is okay. The other patch has a few faults:
> > -    case ATTR_ACCESSKEY:
> >        // ### ignore for the moment
> >         break;
> >+    case ATTR_ACCESSKEY:
> >+        break;
>
> That code is entirely redundant. with your implementation, all those case
> statements you added (and which were already there) can be removed. I
> planned to add a "registerAccessKey" method to DocumentImpl thats why those
> place holders where there.

 If I understood it the way that all attributes should be explicitly handled, 
otherwise the unsupported attribute case in HTMLElementImpl::parseAttribute() 
will be hit.

>
> +    // Set focus node on the document
> +    m_part->xmlDocImpl()->setFocusNode(node);
> +    emit m_part->nodeActivated(Node(node));
> +    node->dispatchUIEvent(EventImpl::DOMACTIVATE_EVENT, 1);
>
> I think the activation should be done before you emit the activate_d_
> signal.

 Ok.

> Furthermore, setFocusNode can trigger something that makes 
> NodeImpl* node point to garbage, you don't want that to happen. To fix,
> make a Node guard, like
>
> Node focusguard(node);
> m_part->xmlDocImpl()->setFocusNode(node);
> ...
> emit m_part->nodeActivated(focusguard);

 So in other words, KHTMLView::focusNextPrevNode() has this broken as well.

>
> >  The second, more important problem I have is how to actually trigger the
> > action in the HTML element.
> > http://lists.w3.org/Archives/Public/www-dom/2002AprJun/0137.html makes me
> > believe just dispatching DOMActivate event like the patch currently does
> > should do, but it doesn't really work for most elements. As I lack any
> > serious knowledge of KHTML/DOM, I have no idea if this is KHTML bug or if
> > it should be done differently.
>
> Its mostly a KHTML bug, or rather, a missing feature.

 Is it documented somewhere how this should work? The best docs I could find 
only explained what the event is, but not when it's generated and so on. I 
e.g. noticed that if I do <form ...><input type="submit" 
onclick="alert('kuk')" accesskey=s></form> , clicking or pressing Space on 
the button shows the alert, by my implementation of accesskey doesn't trigger 
it (it's triggered in Mozilla).

>
> >  PS: Who can I annoy about adding accesskey's for next/previous at
> > bugs.kde.org ;) ?
>
> cvs co bugs/template
>
>
> Dirk

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/




More information about the kfm-devel mailing list