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
55
Issues
55
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
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
2614a4c8
Commit
2614a4c8
authored
Sep 02, 2019
by
Aria Givi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed some minor stuff, added comments
parent
183e7db4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
15 deletions
+36
-15
resources/js/keyboardNavigation.js
resources/js/keyboardNavigation.js
+35
-9
resources/less/metager/pages/resultpage/keyboard-nav.less
resources/less/metager/pages/resultpage/keyboard-nav.less
+1
-6
No files found.
resources/js/keyboardNavigation.js
View file @
2614a4c8
var
ctrlInfo
=
false
;
// Flag used for checking if the user was shown the keyboard control information
/**
* Flag ctrlInfo is used for initial display of the navigation box
*/
var
ctrlInfo
=
false
;
$
(
document
).
ready
(
function
()
{
// Add entry point for tabbing to the first result
$
(
'
[data-index="1"
'
).
attr
(
"
id
"
,
"
results-entry
"
);
$
(
'
#foki a
'
).
first
().
attr
(
"
id
"
,
"
settings-entry
"
);
// Initially focus the searchbar
$
(
'
div.search-input input
'
).
focus
();
});
/**
* Simulate a click on enter keypress when focused on labels
*/
$
(
'
label
'
).
on
(
'
keydown
'
,
function
(
e
)
{
if
(
e
.
keyCode
==
'
13
'
)
{
$
(
this
).
click
();
}
});
/**
* Handles tab keypress and escape keypress
*/
$
(
document
).
on
(
'
keydown
'
,
function
(
e
)
{
e
=
e
||
window
.
event
;
// On first tab keypress there is special behaviour and the ctrlInfo flag is set
if
(
!
ctrlInfo
&&
e
.
keyCode
==
'
9
'
)
{
focus
Info
Box
();
focus
Nav
Box
();
e
.
preventDefault
();
ctrlInfo
=
true
;
}
else
if
(
e
.
keyCode
==
'
27
'
)
{
...
...
@@ -23,24 +34,39 @@ $(document).on('keydown', function(e) {
}
});
function
escKeyPressed
()
{
focusInfoBox
();
$
(
'
input[type="checkbox"]
'
).
removeAttr
(
'
checked
'
);
}
function
focusInfoBox
()
{
/**
* Shows the navigation box and focuses the first <a> tag
*/
function
focusNavBox
()
{
$
(
'
#keyboard-nav-info
'
).
show
();
$
(
'
#keyboard-nav-info a
'
).
first
().
focus
();
}
/**
* Focuses the navigation box and unchecks all checkboxes
*/
function
escKeyPressed
()
{
focusNavBox
();
$
(
'
input[type="checkbox"]
'
).
removeAttr
(
'
checked
'
);
}
/**
* Focuses the first <a> tag of the first result
*/
function
focusResults
()
{
$
(
'
#results-entry .result-title a
'
).
focus
();
}
/**
* Focuses the first <a> tag of the focus options
*/
function
focusSettings
()
{
$
(
'
#foki a
'
).
first
().
focus
();
}
/**
* Focuses the first <tag> of the sidebar
*/
function
focusNavigation
()
{
$
(
'
#sidebarToggle
'
).
prop
(
'
checked
'
,
true
);
$
(
'
.sidebar-list a
'
).
first
().
focus
();
...
...
resources/less/metager/pages/resultpage/keyboard-nav.less
View file @
2614a4c8
/* Keyboard control styles*/
#keyboard-nav-info {
display: none;
position: relative;
...
...
@@ -10,11 +9,7 @@
border: 1px solid #f00;
background-color: #fff;
&:focus {
border: 10px solid yellow;
}
.keyboard-nav-info-header{
.keyboard-nav-info-header {
text-align: center;
h5 {
font-weight: bold;
...
...
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