Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support accesskey like Wikipedia #609

Open
tim-janik opened this issue Nov 30, 2017 · 2 comments
Open

Support accesskey like Wikipedia #609

tim-janik opened this issue Nov 30, 2017 · 2 comments

Comments

@tim-janik
Copy link

tim-janik commented Nov 30, 2017

The $tabs$ generated by gitit are unfortunately not editable via tempates/ so I'm filing this as a bug.
Please add the accesskey attribute to the default HTML generated by gitit, along the lines Wikipedia does it:

<a id="loginlink" class="login" href="/_login"    accesskey="o">
<li><a href="..."  accesskey="c"  >view</a>
<li><a href="..."  accesskey="e" >edit</a></li>
<li><a href="..."  accesskey="h" >history</a></li>
<li><a href="..."  accesskey="t"  >discuss</a></li>
<input name="patterns" id="patterns" type="text"                 accesskey="f" >
<input name="logMsg" id="logMsg" value="" type="text"                 accesskey="b" >
<input name="update" id="update" value="Save" type="submit"     accesskey="s"  >
<input class="editButton" id="previewButton" value="Preview" type="button" accesskey="p"  >
@rybak
Copy link

rybak commented Dec 24, 2022

For reference, what English Wikipedia supports is described at https://en.wikipedia.org/wiki/Wikipedia:Keyboard_shortcuts

@rybak
Copy link

rybak commented Dec 24, 2022

I haven't written Haskell in quite some time, so bare with me.

As an example, "edit" links on English Wikipedia use key e as accesskey. E.g. the main page has following HTML:

<a href="/w/index.php?title=Main_Page&amp;action=edit" title="This page is protected.
You can view its source [Alt+Shift+e]" accesskey="e"><span>View source</span></a>

In Gitit, the "edit" links have _edit in their URL, and it seems to be generated by these lines of code of Gitit:

tabli EditTab << anchor !
[href $ base' ++ "/_edit" ++ urlForPage page ++
case rev of
Just r -> "?revision=" ++ r ++ "&" ++
urlEncodeVars [("logMsg", "Revert to " ++ r)]
Nothing -> ""] << if isNothing rev
then "edit"
else "revert"

It seems that it uses the function anchor from Haskell module Text.XHtml.Strict of xhtml package. Same lines of code also use the href function. Unfortunately, documentation in xhtml package is a bit scarce, but it seems that it would be possible to add support of accesskey attribute via function strAttr.

rybak added a commit to rybak/gitit that referenced this issue Dec 24, 2022
HTML attribute `accesskey` [1] allows user to quickly navigate the
website.  Add support for `accesskey` to links of Gitit using the
shortcut scheme of MediaWiki [2].  This would allow users who edit
MediaWiki websites to more easily navigate Gitit webpages.

Closes jgm#609

[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey
[2] Documented in detail on English Wikipedia, one of the main instances
    of MediaWiki: https://en.wikipedia.org/wiki/Wikipedia:Keyboard_shortcuts
    See also https://www.mediawiki.org/wiki/Manual:Access_keys and
    https://meta.wikimedia.org/wiki/Help:Keyboard_shortcuts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants