Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
0e1777cb
Commit
0e1777cb
authored
11 years ago
by
Anika Henke
Browse files
Options
Downloads
Patches
Plain Diff
added aria attributes to tree and show/hide functions
parent
21134337
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/scripts/behaviour.js
+2
-0
2 additions, 0 deletions
lib/scripts/behaviour.js
lib/scripts/tree.js
+17
-3
17 additions, 3 deletions
lib/scripts/tree.js
with
19 additions
and
3 deletions
lib/scripts/behaviour.js
+
2
−
0
View file @
0e1777cb
...
...
@@ -5,6 +5,7 @@
* @author Adrian Lang <mail@adrianlang.de>
*/
jQuery
.
fn
.
dw_hide
=
function
(
fn
)
{
this
.
attr
(
'
aria-expanded
'
,
'
false
'
);
return
this
.
slideUp
(
'
fast
'
,
fn
);
};
...
...
@@ -15,6 +16,7 @@ jQuery.fn.dw_hide = function(fn) {
* @author Adrian Lang <mail@adrianlang.de>
*/
jQuery
.
fn
.
dw_show
=
function
(
fn
)
{
this
.
attr
(
'
aria-expanded
'
,
'
true
'
);
return
this
.
slideDown
(
'
fast
'
,
fn
);
};
...
...
This diff is collapsed.
Click to expand it.
lib/scripts/tree.js
+
17
−
3
View file @
0e1777cb
...
...
@@ -14,6 +14,12 @@ jQuery.fn.dw_tree = function(overrides) {
init
:
function
()
{
this
.
$obj
.
delegate
(
this
.
toggle_selector
,
'
click
'
,
this
,
this
.
toggle
);
jQuery
(
'
ul:first
'
,
this
.
$obj
).
attr
(
'
role
'
,
'
tree
'
);
jQuery
(
'
ul
'
,
this
.
$obj
).
not
(
'
:first
'
).
attr
(
'
role
'
,
'
group
'
);
jQuery
(
'
li
'
,
this
.
$obj
).
attr
(
'
role
'
,
'
treeitem
'
);
jQuery
(
'
li.open > ul
'
,
this
.
$obj
).
attr
(
'
aria-expanded
'
,
'
true
'
);
jQuery
(
'
li.closed > ul
'
,
this
.
$obj
).
attr
(
'
aria-expanded
'
,
'
false
'
);
jQuery
(
'
li.closed
'
,
this
.
$obj
).
attr
(
'
aria-live
'
,
'
assertive
'
);
},
/**
...
...
@@ -35,8 +41,14 @@ jQuery.fn.dw_tree = function(overrides) {
$listitem
=
$clicky
.
closest
(
'
li
'
);
$sublist
=
$listitem
.
find
(
'
ul
'
).
first
();
opening
=
$listitem
.
hasClass
(
'
closed
'
);
$listitem
.
toggleClass
(
'
open closed
'
);
dw_tree
.
toggle_display
(
$clicky
,
opening
);
if
(
$sublist
.
is
(
'
:visible
'
))
{
$listitem
.
removeClass
(
'
open
'
).
addClass
(
'
closed
'
);
$sublist
.
attr
(
'
aria-expanded
'
,
'
false
'
);
}
else
{
$listitem
.
removeClass
(
'
closed
'
).
addClass
(
'
open
'
);
$sublist
.
attr
(
'
aria-expanded
'
,
'
true
'
);
}
// if already open, close by hiding the sublist
if
(
!
opening
)
{
...
...
@@ -48,6 +60,8 @@ jQuery.fn.dw_tree = function(overrides) {
$sublist
.
hide
();
if
(
typeof
data
!==
'
undefined
'
)
{
$sublist
.
html
(
data
);
$sublist
.
parent
().
attr
(
'
aria-busy
'
,
'
false
'
).
removeAttr
(
'
aria-live
'
);
jQuery
(
'
li.closed
'
,
$sublist
).
attr
(
'
aria-live
'
,
'
assertive
'
);
}
if
(
$listitem
.
hasClass
(
'
open
'
))
{
// Only show if user didn’t close the list since starting
...
...
@@ -63,11 +77,11 @@ jQuery.fn.dw_tree = function(overrides) {
}
//prepare the new ul
$sublist
=
jQuery
(
'
<ul class="idx"/>
'
);
$sublist
=
jQuery
(
'
<ul class="idx"
role="group"
/>
'
);
$listitem
.
append
(
$sublist
);
timeout
=
window
.
setTimeout
(
bind
(
show_sublist
,
'
<li><img src="
'
+
DOKU_BASE
+
'
lib/images/throbber.gif" alt="loading..." title="loading..." /></li>
'
),
dw_tree
.
throbber_delay
);
bind
(
show_sublist
,
'
<li
aria-busy="true"
><img src="
'
+
DOKU_BASE
+
'
lib/images/throbber.gif" alt="loading..." title="loading..." /></li>
'
),
dw_tree
.
throbber_delay
);
dw_tree
.
load_data
(
function
(
data
)
{
window
.
clearTimeout
(
timeout
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment