From f024583011f0d5c490a9d755d362764dd0ebd7b0 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 24 May 2022 09:09:54 +0200 Subject: [PATCH] add a11y jumpers --- copyparty/web/browser.css | 13 +++++++++++++ copyparty/web/browser.js | 22 ++++++++++++++++++++++ copyparty/web/up2k.js | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index aad5768e..f41cbe10 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -379,6 +379,19 @@ html, body { pre, code, tt, #doc, #doc>code { font-family: 'scp', monospace, monospace; } +.ayjump { + position: fixed; + z-index: 80386; + top: .5em; + left: .5em; + padding: .5em .7em; + background: var(--bg); + opacity: 0; +} +.ayjump:focus { + opacity: 1; + outline: none; +} #path, #path * { font-size: 1em; diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 10922d90..e8cce017 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -43,6 +43,9 @@ var Ls = { "ab_mkdoc": "new markdown doc", "ab_msg": "send msg to srv log", + "ay_path": "jump to folders", + "ay_files": "jump to files", + "wt_ren": "rename selected items$NHotkey: F2", "wt_del": "delete selected items$NHotkey: ctrl-K", "wt_cut": "cut selected items <small>(then paste somewhere else)</small>$NHotkey: ctrl-X", @@ -363,6 +366,9 @@ var Ls = { "ab_mkdoc": "nytt dokument", "ab_msg": "send melding", + "ay_path": "hopp til mapper", + "ay_files": "hopp til filer", + "wt_ren": "gi nye navn til de valgte filene$NSnarvei: F2", "wt_del": "slett de valgte filene$NSnarvei: ctrl-K", "wt_cut": "klipp ut de valgte filene <small>(for å lime inn et annet sted)</small>$NSnarvei: ctrl-X", @@ -2352,6 +2358,22 @@ function eval_hash() { (function () { + for (var a = 0; a < 2; a++) + (function (a) { + var d = mknod('a'); + d.setAttribute('href', '#'); + d.setAttribute('class', 'ayjump'); + d.innerHTML = a ? L.ay_path : L.ay_files; + document.body.insertBefore(d, ebi('ops')); + d.onclick = function (e) { + ev(e); + if (a) + QS(treectl.hidden ? '#path a:nth-last-child(2)' : '#treeul a.hl').focus(); + else + QS(thegrid.en ? '#ggrid a' : '#files tbody a').focus(); + }; + })(a); + var d = mknod('div'); d.setAttribute('id', 'acc_info'); document.body.insertBefore(d, ebi('ops')); diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 572263ca..055d6482 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -587,8 +587,8 @@ function up2k_init(subtle) { function unmodal() { ebi('u2notbtn').style.display = 'none'; - ebi('u2btn').style.display = 'block'; ebi('u2conf').style.opacity = '1'; + ebi('u2btn').style.display = ''; ebi('u2notbtn').innerHTML = ''; }