Page MenuHomePhabricator

Rewrite of accesskey javascript akeytt
Closed, ResolvedPublic

Description

I was going to add accesskeys to next and previous links in the history browsing
modes, but run problems with akeytt. Looks like it tries to find a element,
which child is a a-element. That's ok because almost all those links are in
format li > a. If the else-clause was meant to be fallback, which I think it was
meant to be, it didn't work. So i rewrote the function so it tries to find a
a-element directly or in the first child element.

Ask for clarification if you don't understand my poor explanation. Nevertheless
i'll add a patch for it.


Version: 1.5.x
Severity: major
URL: http://jadesukka.homelinux.org:8180/mediawiki15b/index.php?title=Nextprev&diff=1046&oldid=1045

Details

Reference
bz1960

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:19 PM
bzimport set Reference to bz1960.
bzimport added a subscriber: Unknown Object (MLST).

Created attachment 452
A patch for akeytt

Attached:

It's a little unclear what problem this patch is solving. :)

Can you clarify what breaks with the current code, and how this fixes it?

Well...
The original basically changed <xxx id="b"><a> construct to <xxx id="b"><a
title="xy" acceskey="x">.
The problem was that it didn't work if the id was put directly to anchor
element, like <a id="c">. In other words you have to encapsulate the link with
another element with id in it.

My version first checks if the given tag is an anchor element (<a id="c">) and
if it isn't, it falls back to the original behaviour. In other words it tries to
assign accesskey parameter to anchor element, not only to the first child of
element which has the id we searched for. I think this is also how the original
version was meant to behave.

This problem came up as i was adding accesskeys to next/previous diff links
which were not encapsulated by another element.

Original:
<xxx id="b"><a> to <xxx id="b"><a title="xy" acceskey="x">

New:
<xxx id="b"><a> to <xxx id="b"><a title="xy" acceskey="x">
or
<a id="c"> to <a id="c" title="xy" acceskey="x">

I've committed this to HEAD, no problems reported so far.