##// END OF EJS Templates
templates: add ARIA markup to dropdown menus...
Andrew Shadura -
r6209:24a0c176 default
parent child Browse files
Show More
@@ -139,11 +139,11 b''
139 </li>
139 </li>
140 <li ${is_current('options')} data-context="options" class="dropdown">
140 <li ${is_current('options')} data-context="options" class="dropdown">
141 %if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
141 %if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
142 <a href="${h.url('edit_repo',repo_name=c.repo_name)}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"><i class="icon-wrench"></i> ${_('Options')} <i class="caret"></i></a>
142 <a href="${h.url('edit_repo',repo_name=c.repo_name)}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true"><i class="icon-wrench"></i> ${_('Options')} <i class="caret"></i></a>
143 %else:
143 %else:
144 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"><i class="icon-wrench"></i> ${_('Options')} <i class="caret"></i></a>
144 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true"><i class="icon-wrench"></i> ${_('Options')} <i class="caret"></i></a>
145 %endif
145 %endif
146 <ul class="dropdown-menu" role="menu">
146 <ul class="dropdown-menu" role="menu" aria-hidden="yes">
147 %if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
147 %if h.HasRepoPermissionAny('repository.admin')(c.repo_name):
148 <li><a href="${h.url('edit_repo',repo_name=c.repo_name)}"><i class="icon-gear"></i> ${_('Settings')}</a></li>
148 <li><a href="${h.url('edit_repo',repo_name=c.repo_name)}"><i class="icon-gear"></i> ${_('Settings')}</a></li>
149 %endif
149 %endif
@@ -361,11 +361,12 b''
361 ## USER MENU
361 ## USER MENU
362 <li class="dropdown">
362 <li class="dropdown">
363 <a class="menu_link dropdown-toggle" data-toggle="dropdown" role="button" id="quick_login_link"
363 <a class="menu_link dropdown-toggle" data-toggle="dropdown" role="button" id="quick_login_link"
364 aria-expanded="false" aria-controls="quick_login"
364 %if c.authuser.username != 'default':
365 %if c.authuser.username != 'default':
365 href="${h.url('notifications')}"
366 href="${h.url('notifications')}"
366 %endif
367 %endif
367 >
368 >
368 ${h.gravatar_div(c.authuser.email, size=20, div_class="icon", div_style="display:inline")}
369 ${h.gravatar_div(c.authuser.email, size=20, div_class="icon", div_style="display:inline", div_aria_hidden="true")}
369 %if c.authuser.username != 'default':
370 %if c.authuser.username != 'default':
370 <span class="menu_link_user">${c.authuser.username}</span>
371 <span class="menu_link_user">${c.authuser.username}</span>
371 %if c.unread_notifications != 0:
372 %if c.unread_notifications != 0:
@@ -376,10 +377,10 b''
376 %endif
377 %endif
377 </a>
378 </a>
378
379
379 <div class="user-menu">
380 <div class="user-menu" role="menu">
380 <div id="quick_login" class="dropdown-menu">
381 <div id="quick_login" role="form" aria-describedby="quick_login_h" aria-hidden="true" class="dropdown-menu">
381 %if c.authuser.username == 'default' or c.authuser.user_id is None:
382 %if c.authuser.username == 'default' or c.authuser.user_id is None:
382 <h4>${_('Login to Your Account')}</h4>
383 <h4 id="quick_login_h">${_('Login to Your Account')}</h4>
383 ${h.form(h.url('login_home', came_from=request.path_qs))}
384 ${h.form(h.url('login_home', came_from=request.path_qs))}
384 <div class="form">
385 <div class="form">
385 <div class="fields">
386 <div class="fields">
@@ -529,6 +530,20 b''
529 e.preventDefault();
530 e.preventDefault();
530 window.location = pyroutes.url('summary_home', {'repo_name': e.val});
531 window.location = pyroutes.url('summary_home', {'repo_name': e.val});
531 });
532 });
533
534 $(document).on('shown.bs.dropdown', function(event) {
535 var dropdown = $(event.target);
536
537 dropdown.attr('aria-expanded', true);
538 dropdown.find('.dropdown-menu').attr('aria-hidden', false);
539 });
540
541 $(document).on('hidden.bs.dropdown', function(event) {
542 var dropdown = $(event.target);
543
544 dropdown.attr('aria-expanded', false);
545 dropdown.find('.dropdown-menu').attr('aria-hidden', true);
546 });
532 });
547 });
533 </script>
548 </script>
534 </%def>
549 </%def>
General Comments 0
You need to be logged in to leave comments. Login now