Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
MetaGer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
56
Issues
56
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
open-source
MetaGer
Commits
251bb8bf
Commit
251bb8bf
authored
Aug 01, 2019
by
Aria Givi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
results can now be chosen, tabbing between anchor elements still missing
parent
2396367e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
resources/js/keyboardNavigation.js
resources/js/keyboardNavigation.js
+25
-12
No files found.
resources/js/keyboardNavigation.js
View file @
251bb8bf
var
ctrlInfo
=
false
;
// Flag used for checking if the user was shown the keyboard control information
/* var currentElement = [
["Results", false]
];
*/
var
currentResultIndex
=
1
;
// stores result which was focused last
document
.
onkeydown
=
checkKey
;
function
checkKey
(
e
)
{
$
(
document
).
on
(
'
keydown
'
,
function
(
e
)
{
e
=
e
||
window
.
event
;
// Check for TAB keypress
// Check for TAB keypress
if
(
e
.
keyCode
==
'
9
'
)
{
e
.
preventDefault
();
tabKeyPressed
(
$
(
document
.
activeElement
));
tabKeyPressed
();
}
else
if
(
e
.
keyCode
==
'
13
'
)
{
enterKeyPressed
();
}
}
}
);
function
tabKeyPressed
()
{
if
(
!
ctrlInfo
)
{
...
...
@@ -20,16 +26,22 @@ function tabKeyPressed() {
}
}
function
enterKeyPressed
()
{
if
(
$
(
"
:focus
"
).
hasClass
(
"
result
"
))
{
//$(":focus").children("a").focus();
console
.
log
(
$
(
"
:focus
"
).
children
(
"
a
"
));
}
}
function
showInfoBox
()
{
$
(
"
#keyboard-ctrl-info
"
).
show
();
$
(
"
#keyboard-ctrl-info
"
).
focus
();
infoBox
=
$
(
"
#keyboard-ctrl-info
"
);
infoBox
.
show
();
infoBox
.
focus
();
}
function
focusNextElement
(
currentFocus
)
{
if
(
currentFocus
.
hasClass
(
"
result
"
))
{
focusNextResult
(
currentFocus
);
}
else
if
(
false
)
{
}
else
{
focusResult
();
}
...
...
@@ -42,8 +54,9 @@ function focusResult() {
}
function
focusNextResult
(
currentFocus
)
{
if
(
!
currentFocus
.
next
().
focus
())
{
alert
(
"
test
"
);
if
(
currentFocus
.
next
().
length
>
0
)
{
currentFocus
.
next
().
focus
();
}
else
{
$
(
"
div[.result]
"
).
first
().
focus
();
}
console
.
log
(
currentFocus
);
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment