mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 14:21:23 +00:00
Add accessiblity support to simplemodal
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
{% load avatar_tags i18n %}
|
{% load avatar_tags i18n %}
|
||||||
<script type="text/template" id="create-repo-tmpl">
|
<script type="text/template" id="create-repo-tmpl">
|
||||||
<form id="repo-create-form" action="" method="post">{% csrf_token %}
|
<form id="repo-create-form" action="" method="post">{% csrf_token %}
|
||||||
<h3>{% trans "New Library"%}</h3>
|
<h3 id="dialogTitle">{% trans "New Library"%}</h3>
|
||||||
<label>{% trans "Name"%}</label><br/>
|
<label for="repo-name">{% trans "Name"%}</label><br/>
|
||||||
<input type="text" name="repo_name" value="" maxlength="{{max_file_name}}" class="input" /><br />
|
<input id="repo-name" type="text" name="repo_name" value="" maxlength="{{max_file_name}}" class="input" /><br />
|
||||||
<% if (showSharePerm) { %>
|
<% if (showSharePerm) { %>
|
||||||
<label>{% trans "Share Permission" %}</label><br />
|
<label for="share-permission">{% trans "Share Permission" %}</label><br />
|
||||||
<select name="permission" class="perm">
|
<select id="share-permission" name="permission" class="perm">
|
||||||
<option value="rw" selected="selected">{% trans "Read-Write" %}</option>
|
<option value="rw" selected="selected">{% trans "Read-Write" %}</option>
|
||||||
<option value="r">{% trans "Read-Only" %}</option>
|
<option value="r">{% trans "Read-Only" %}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@@ -86,6 +86,8 @@
|
|||||||
browser.ie7 = browser.msie && /msie 7.0/.test(ua);
|
browser.ie7 = browser.msie && /msie 7.0/.test(ua);
|
||||||
browser.boxModel = (document.compatMode === "CSS1Compat");
|
browser.boxModel = (document.compatMode === "CSS1Compat");
|
||||||
|
|
||||||
|
var focusedBeforeDialog;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create and display a modal dialog.
|
* Create and display a modal dialog.
|
||||||
*
|
*
|
||||||
@@ -323,6 +325,7 @@
|
|||||||
// create the overlay
|
// create the overlay
|
||||||
s.d.overlay = $('<div></div>')
|
s.d.overlay = $('<div></div>')
|
||||||
.attr('id', s.o.overlayId)
|
.attr('id', s.o.overlayId)
|
||||||
|
.attr('tabIndex', -1)
|
||||||
.addClass('simplemodal-overlay')
|
.addClass('simplemodal-overlay')
|
||||||
.css($.extend(s.o.overlayCss, {
|
.css($.extend(s.o.overlayCss, {
|
||||||
display: 'none',
|
display: 'none',
|
||||||
@@ -337,7 +340,7 @@
|
|||||||
.appendTo(s.o.appendTo);
|
.appendTo(s.o.appendTo);
|
||||||
|
|
||||||
// create the container
|
// create the container
|
||||||
s.d.container = $('<div></div>')
|
s.d.container = $('<div role="dialog" aria-labelledby="dialogTitle" aria-describedby="dialogDiscription"></div>')
|
||||||
.attr('id', s.o.containerId)
|
.attr('id', s.o.containerId)
|
||||||
.addClass('simplemodal-container')
|
.addClass('simplemodal-container')
|
||||||
.css($.extend(
|
.css($.extend(
|
||||||
@@ -350,8 +353,7 @@
|
|||||||
: '')
|
: '')
|
||||||
.appendTo(s.o.appendTo);
|
.appendTo(s.o.appendTo);
|
||||||
|
|
||||||
s.d.wrap = $('<div></div>')
|
s.d.wrap = $('<div role="document"></div>')
|
||||||
.attr('tabIndex', -1)
|
|
||||||
.addClass('simplemodal-wrap')
|
.addClass('simplemodal-wrap')
|
||||||
.css({height: '100%', outline: 0, width: '100%'})
|
.css({height: '100%', outline: 0, width: '100%'})
|
||||||
.appendTo(s.d.container);
|
.appendTo(s.d.container);
|
||||||
@@ -649,6 +651,7 @@
|
|||||||
s.d.data.show();
|
s.d.data.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
focusedBeforeDialog = document.activeElement;
|
||||||
s.o.focus && s.focus();
|
s.o.focus && s.focus();
|
||||||
|
|
||||||
// bind default events
|
// bind default events
|
||||||
@@ -671,6 +674,8 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
focusedBeforeDialog && focusedBeforeDialog.focus();
|
||||||
|
|
||||||
// remove the default events
|
// remove the default events
|
||||||
s.unbindEvents();
|
s.unbindEvents();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user