diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2015-11-18 19:28:03 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2015-11-18 19:28:03 +0100 |
commit | 6893733a646d9e697b85feef39dc047c70dd601c (patch) | |
tree | 579e6c4eab908331411f32fc0109002eb12f1da3 /js/codeq/problem_list.js | |
parent | e92caf57bbad2af886b48d8ff82d8fece214b783 (diff) |
Add support for tabkey and accesskey navigation
Diffstat (limited to 'js/codeq/problem_list.js')
-rw-r--r-- | js/codeq/problem_list.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/js/codeq/problem_list.js b/js/codeq/problem_list.js index 853c8cb..cc9e716 100644 --- a/js/codeq/problem_list.js +++ b/js/codeq/problem_list.js @@ -200,7 +200,8 @@ Ngroups = groups.length, html = [], problemReferences = [], - group, problems, Nproblems, problem, i, j; + group, problems, Nproblems, problem, i, j, nrefs, + baseTabIndex = 200; // tabindex attribute of the first problem link var langDict = convertTranslations(rawTranslations, 'name', 'description'), // this will be the resulting dictionary: multi-level keys that lead up to the lang-dict groupDict, problemDict; // title: HTML structure for "name" and "desc" @@ -218,9 +219,10 @@ problems = group.problems || []; Nproblems = problems.length; for (j = 0; j < Nproblems; j++) { + nrefs = problemReferences.length; problem = problems[j] || {}; problemDict = convertTranslations(problem.translations, 'name'); - html.push('<li><a class="problem-', '' + problemReferences.length, '" ', ta(problemDict.name), '></a></li>'); + html.push('<li><a href="#" tabindex="' + (baseTabIndex+nrefs) + '"' + ' class="problem-', '' + nrefs, '" ', ta(problemDict.name), '></a></li>'); problemReferences.push({'g': group.identifier || 'nogroup', 'p': problem.identifier || 'noproblem', 'id': problem.id}); } html.push('</ul>'); @@ -254,7 +256,7 @@ ref = data.refs[index]; if (!ref) { codeq.log.error('Clicked on a problem link having erroneous index: ' + index); - return; + return false; } codeq.wait( Q.all([ @@ -272,6 +274,7 @@ alert('Failed to obtain the problem definition: ' + reason); }) .done(); + return false; }); }, |