mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-69588 accessibility: Address further review points
This commit is contained in:
parent
56c34d71ef
commit
c1130de5ff
@ -11,7 +11,6 @@ $query = trim(optional_param('query', '', PARAM_NOTAGS)); // Search string
|
||||
|
||||
$context = context_system::instance();
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->has_secondary_navigation();
|
||||
|
||||
$hassiteconfig = has_capability('moodle/site:config', $context);
|
||||
|
||||
@ -91,7 +90,7 @@ if ($hassiteconfig) {
|
||||
if ($showsettingslinks) {
|
||||
$node = $PAGE->settingsnav->find('root', navigation_node::TYPE_SITE_ADMIN);
|
||||
if ($node) {
|
||||
$moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs', true);
|
||||
$moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs');
|
||||
$secondarynavigation = $moremenu->export_for_template($OUTPUT);
|
||||
echo $OUTPUT->render_from_template('core/settings_link_page',
|
||||
['node' => $node, 'secondarynavigation' => $secondarynavigation]);
|
||||
|
@ -34,7 +34,7 @@ Feature: Verify that keyboard steps work as expected
|
||||
| username | email | firstname | lastname |
|
||||
| saffronr | saffron.rutledge@example.com | Saffron | Rutledge |
|
||||
And I log in as "saffronr"
|
||||
And I click on "Saffron Rutledge" "link" in the ".usermenu" "css_element"
|
||||
And I click on "Saffron Rutledge" "button" in the ".usermenu" "css_element"
|
||||
When I press the up key
|
||||
Then the focused element is "Log out" "link"
|
||||
|
||||
|
2
lib/amd/build/keyboard_navigation.min.js
vendored
2
lib/amd/build/keyboard_navigation.min.js
vendored
@ -1,2 +0,0 @@
|
||||
define ("core/keyboard_navigation",["exports","core/key_codes"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var c={menuitem:"[role=\"menuitem\"]",menu:"[role=\"menu\"]"},d=null,e=function(a,b){if(null!==a){return a}else{return b}},f=function(a){var e=a.srcElement,f=a.currentTarget.firstElementChild,k=j(a.currentTarget);if(e.classList.contains("dropdown-item")){if(a.keyCode===b.arrowRight||a.keyCode===b.arrowLeft){a.preventDefault();if(null!==d){d.parentElement.click()}}if(a.keyCode===b.space||a.keyCode===b.enter){a.preventDefault();Array.prototype.forEach.call(e.closest(".dropdown-menu").children,function(a){a.querySelector(c.menuitem).classList.remove("active")});if(!e.parentElement.classList.contains("dropdown")){e.click()}}}else{if(a.keyCode===b.arrowRight){a.preventDefault();g(e,f)}if(a.keyCode===b.arrowLeft){a.preventDefault();h(e,k)}if(a.keyCode===b.arrowUp||a.keyCode===b.arrowDown){d=e;a.preventDefault()}if(a.keyCode===b.home){a.preventDefault();i(f)}if(a.keyCode===b.end){a.preventDefault();i(k)}if(a.keyCode===b.space||a.keyCode===b.enter){a.preventDefault();if(!e.parentElement.classList.contains("dropdown")){e.click()}}}};a.default=function(a){a.removeEventListener("keydown",f);a.addEventListener("keydown",f)};var g=function(a,b){var d=a.parentElement.nextElementSibling,f=e(d,b),g=f.querySelector(c.menuitem);g.focus()},h=function(a,b){var d=a.parentElement.previousElementSibling,f=e(d,b),g=f.querySelector(c.menuitem);g.focus()},i=function(a){a.querySelector(c.menuitem).focus()},j=function(a){var b=a.lastElementChild;if(!b.classList.contains("d-none")){return a.lastElementChild}else{var c=Array.prototype.map.call(a.children,function(a){return a}).reverse(),d=c.filter(function(a){if(!a.classList.contains("d-none")){return a}});if(0!==d.length){return d[0]}else{return a.firstElementChild}}};return a.default});
|
||||
//# sourceMappingURL=keyboard_navigation.min.js.map
|
File diff suppressed because one or more lines are too long
2
lib/amd/build/menu_navigation.min.js
vendored
Normal file
2
lib/amd/build/menu_navigation.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
define ("core/menu_navigation",["exports","core/key_codes"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var c={menuitem:"[role=\"menuitem\"]",menu:"[role=\"menu\"]"},d=null,e=function(a,b){if(null!==a){return a}else{return b}},f=function(a){var e=a.srcElement,f=a.currentTarget.firstElementChild,k=j(a.currentTarget);if(e.classList.contains("dropdown-item")){if(a.keyCode===b.arrowRight||a.keyCode===b.arrowLeft){a.preventDefault();if(null!==d){d.parentElement.click()}}if(a.keyCode===b.space||a.keyCode===b.enter){a.preventDefault();Array.prototype.forEach.call(e.closest(".dropdown-menu").children,function(a){a.querySelector(c.menuitem).classList.remove("active");a.setAttribute("aria-current","false")});if(!e.parentElement.classList.contains("dropdown")){e.click()}}}else{if(a.keyCode===b.arrowRight){a.preventDefault();g(e,f)}if(a.keyCode===b.arrowLeft){a.preventDefault();h(e,k)}if(a.keyCode===b.arrowUp||a.keyCode===b.arrowDown){d=e;a.preventDefault()}if(a.keyCode===b.home){a.preventDefault();e.setAttribute("aria-current","false");i(f)}if(a.keyCode===b.end){a.preventDefault();e.currentNode.setAttribute("aria-current","false");i(k)}if(a.keyCode===b.space||a.keyCode===b.enter){a.preventDefault();if(!e.parentElement.classList.contains("dropdown")){e.click()}}}};a.default=function(a){a.removeEventListener("keydown",f);a.addEventListener("keydown",f)};var g=function(a,b){var d=a.parentElement.nextElementSibling,f=e(d,b),g=f.querySelector(c.menuitem);a.setAttribute("aria-current","false");g.setAttribute("aria-current","true");g.focus()},h=function(a,b){var d=a.parentElement.previousElementSibling,f=e(d,b),g=f.querySelector(c.menuitem);a.setAttribute("aria-current","false");g.setAttribute("aria-current","true");g.focus()},i=function(a){a.querySelector(c.menuitem).focus();a.querySelector(c.menuitem).setAttribute("aria-current","true")},j=function(a){var b=a.lastElementChild;if(!b.classList.contains("d-none")){return a.lastElementChild}else{var c=Array.prototype.map.call(a.children,function(a){return a}).reverse(),d=c.filter(function(a){if(!a.classList.contains("d-none")){return a}});if(0!==d.length){return d[0]}else{return a.firstElementChild}}};return a.default});
|
||||
//# sourceMappingURL=menu_navigation.min.js.map
|
1
lib/amd/build/menu_navigation.min.js.map
Normal file
1
lib/amd/build/menu_navigation.min.js.map
Normal file
File diff suppressed because one or more lines are too long
2
lib/amd/build/moremenu.min.js
vendored
2
lib/amd/build/moremenu.min.js
vendored
@ -1,2 +1,2 @@
|
||||
define ("core/moremenu",["exports","jquery","core/keyboard_navigation"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}var f={regions:{moredropdown:"[data-region=\"moredropdown\"]",morebutton:"[data-region=\"morebutton\"]"},classes:{dropdownitem:"dropdown-item",dropdownmoremenu:"dropdownmoremenu",dropdowntoggle:"dropdown-toggle",hidden:"d-none",active:"active",nav:"nav",navlink:"nav-link",observed:"observed"},attributes:{menu:"[role=\"menu\"]"}},g=function(a){var b=a.parentNode.offsetHeight+1,c=a.querySelector(f.regions.moredropdown),d=a.querySelector(f.regions.morebutton);if(a.offsetHeight>b){d.classList.remove(f.classes.hidden);var e=Array.from(a.children).reverse();e.forEach(function(c){if(!c.classList.contains(f.classes.dropdownmoremenu)){if(a.offsetHeight>b){var d=a.removeChild(c);h(a,d,!0)}}})}else{if("children"in c){var j=Array.from(c.children);j.forEach(function(d){if(a.offsetHeight<b&&"true"!==d.dataset.forceintomoremenu){var e=c.removeChild(d);i(a,e)}});if(0===j.length){d.classList.add(f.classes.hidden)}}if(a.offsetHeight>b){g(a)}}a.parentNode.classList.add(f.classes.observed)},h=function(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!1,d=a.querySelector(f.regions.moredropdown),e=a.querySelector("."+f.classes.dropdowntoggle),g=b.querySelector("."+f.classes.navlink);b.setAttribute("prev-role",b.getAttribute("role"));b.setAttribute("role","menuitem");if(g.classList.contains(f.classes.active)){e.classList.add(f.classes.active)}g.classList.remove(f.classes.navlink);g.classList.add(f.classes.dropdownitem);if(c){d.prepend(b)}else{d.append(b)}},i=function(a,b){var c=a.querySelector(f.regions.morebutton),d=a.querySelector("."+f.classes.dropdowntoggle),e=b.querySelector("."+f.classes.dropdownitem);b.setAttribute("role",b.getAttribute("prev-role"));if(e){var g=e.getAttribute("role");if("menuitem"===g){e.removeAttribute("role")}}if(e.classList.contains(f.classes.active)){d.classList.remove(f.classes.active)}e.classList.remove(f.classes.dropdownitem);e.classList.add(f.classes.navlink);a.insertBefore(b,c)},j=function(a){a.firstElementChild.querySelector("[role=\"menuitem\"]").setAttribute("tabindex","0");if("children"in a){var d=a.querySelector(f.regions.morebutton),e=Array.from(a.children);e.forEach(function(b){if(!b.classList.contains(f.classes.dropdownmoremenu)&&"true"===b.dataset.forceintomoremenu){h(a,b,!1);if(d.classList.contains(f.classes.hidden)){d.classList.remove(f.classes.hidden)}}})}g(a);(0,c.default)(a);window.addEventListener("resize",function(){g(a);(0,c.default)(a)});var i=function(a){var b=a.target.parentNode.querySelector(f.attributes.menu);if(b){b.classList.toggle("show")}a.stopPropagation()};(0,b.default)("."+f.classes.dropdownmoremenu).on("show.bs.dropdown",function(){var b=a.querySelector(f.regions.moredropdown);b.querySelectorAll(".dropdown").forEach(function(a){a.removeEventListener("click",i,!0);a.addEventListener("click",i,!0)})})};a.default=j;return a.default});
|
||||
define ("core/moremenu",["exports","jquery","core/menu_navigation"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}var f={regions:{moredropdown:"[data-region=\"moredropdown\"]",morebutton:"[data-region=\"morebutton\"]"},classes:{dropdownitem:"dropdown-item",dropdownmoremenu:"dropdownmoremenu",dropdowntoggle:"dropdown-toggle",hidden:"d-none",active:"active",nav:"nav",navlink:"nav-link",observed:"observed"},attributes:{menu:"[role=\"menu\"]"}},g=function(a){var b=a.parentNode.offsetHeight+1,c=a.querySelector(f.regions.moredropdown),d=a.querySelector(f.regions.morebutton);if(a.offsetHeight>b){d.classList.remove(f.classes.hidden);var e=Array.from(a.children).reverse();e.forEach(function(c){if(!c.classList.contains(f.classes.dropdownmoremenu)){if(a.offsetHeight>b){var d=a.removeChild(c);h(a,d,!0)}}})}else{if("children"in c){var j=Array.from(c.children);j.forEach(function(d){if(a.offsetHeight<b&&"true"!==d.dataset.forceintomoremenu){var e=c.removeChild(d);i(a,e)}});if(0===j.length){d.classList.add(f.classes.hidden)}}if(a.offsetHeight>b){g(a)}}a.parentNode.classList.add(f.classes.observed)},h=function(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:!1,d=a.querySelector(f.regions.moredropdown),e=a.querySelector("."+f.classes.dropdowntoggle),g=b.querySelector("."+f.classes.navlink);if(g.classList.contains(f.classes.active)){e.classList.add(f.classes.active)}g.classList.remove(f.classes.navlink);g.classList.add(f.classes.dropdownitem);if(c){d.prepend(b)}else{d.append(b)}},i=function(a,b){var c=a.querySelector(f.regions.morebutton),d=a.querySelector("."+f.classes.dropdowntoggle),e=b.querySelector("."+f.classes.dropdownitem);if(e.classList.contains(f.classes.active)){d.classList.remove(f.classes.active)}e.classList.remove(f.classes.dropdownitem);e.classList.add(f.classes.navlink);a.insertBefore(b,c)},j=function(a){a.firstElementChild.querySelector("[role=\"menuitem\"]").setAttribute("tabindex","0");if("children"in a){var d=a.querySelector(f.regions.morebutton),e=Array.from(a.children);e.forEach(function(b){if(!b.classList.contains(f.classes.dropdownmoremenu)&&"true"===b.dataset.forceintomoremenu){h(a,b,!1);if(d.classList.contains(f.classes.hidden)){d.classList.remove(f.classes.hidden)}}})}g(a);(0,c.default)(a);window.addEventListener("resize",function(){g(a);(0,c.default)(a)});var i=function(a){var b=a.target.parentNode.querySelector(f.attributes.menu);if(b){b.classList.toggle("show")}a.stopPropagation()};(0,b.default)("."+f.classes.dropdownmoremenu).on("show.bs.dropdown",function(){var b=a.querySelector(f.regions.moredropdown);b.querySelectorAll(".dropdown").forEach(function(a){a.removeEventListener("click",i,!0);a.addEventListener("click",i,!0)})})};a.default=j;return a.default});
|
||||
//# sourceMappingURL=moremenu.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -17,7 +17,6 @@
|
||||
* Keyboard initialization for a given html node.
|
||||
*
|
||||
* @module core/keyboard_navigation
|
||||
* @package core
|
||||
* @copyright 2021 Moodle
|
||||
* @author Mathew May <mathew.solutions>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -74,6 +73,7 @@ const listenerEvents = e => {
|
||||
// Remove active class from any other dropdown elements.
|
||||
Array.prototype.forEach.call(src.closest('.dropdown-menu').children, node => {
|
||||
node.querySelector(SELECTORS.menuitem).classList.remove('active');
|
||||
node.setAttribute('aria-current', 'false');
|
||||
});
|
||||
|
||||
if (!src.parentElement.classList.contains('dropdown')) {
|
||||
@ -97,10 +97,12 @@ const listenerEvents = e => {
|
||||
}
|
||||
if (e.keyCode === home) {
|
||||
e.preventDefault();
|
||||
src.setAttribute('aria-current', 'false');
|
||||
setFocusHomeEnd(firstNode);
|
||||
}
|
||||
if (e.keyCode === end) {
|
||||
e.preventDefault();
|
||||
src.currentNode.setAttribute('aria-current', 'false');
|
||||
setFocusHomeEnd(lastNode);
|
||||
}
|
||||
if (e.keyCode === space ||
|
||||
@ -134,6 +136,8 @@ const setFocusNext = (currentNode, firstNode) => {
|
||||
const nextListItem = currentNode.parentElement.nextElementSibling;
|
||||
const nodeToSelect = clickErrorHandler(nextListItem, firstNode);
|
||||
const menuItem = nodeToSelect.querySelector(SELECTORS.menuitem);
|
||||
currentNode.setAttribute('aria-current', 'false');
|
||||
menuItem.setAttribute('aria-current', 'true');
|
||||
menuItem.focus();
|
||||
};
|
||||
|
||||
@ -147,6 +151,8 @@ const setFocusPrev = (currentNode, lastNode) => {
|
||||
const nextListItem = currentNode.parentElement.previousElementSibling;
|
||||
const nodeToSelect = clickErrorHandler(nextListItem, lastNode);
|
||||
const menuItem = nodeToSelect.querySelector(SELECTORS.menuitem);
|
||||
currentNode.setAttribute('aria-current', 'false');
|
||||
menuItem.setAttribute('aria-current', 'true');
|
||||
menuItem.focus();
|
||||
};
|
||||
|
||||
@ -157,6 +163,7 @@ const setFocusPrev = (currentNode, lastNode) => {
|
||||
*/
|
||||
const setFocusHomeEnd = node => {
|
||||
node.querySelector(SELECTORS.menuitem).focus();
|
||||
node.querySelector(SELECTORS.menuitem).setAttribute('aria-current', 'true');
|
||||
};
|
||||
|
||||
/**
|
@ -17,14 +17,13 @@
|
||||
* Moves wrapping navigation items into a more menu.
|
||||
*
|
||||
* @module core/moremenu
|
||||
* @package core
|
||||
* @copyright 2021 Moodle
|
||||
* @author Bas Brands <bas@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
import $ from 'jquery';
|
||||
import keyboard_navigation from "core/keyboard_navigation";
|
||||
import menu_navigation from "core/menu_navigation";
|
||||
/**
|
||||
* Moremenu selectors.
|
||||
*/
|
||||
@ -120,9 +119,6 @@ const moveIntoMoreDropdown = (menu, navNode, prepend = false) => {
|
||||
const dropdownToggle = menu.querySelector('.' + Selectors.classes.dropdowntoggle);
|
||||
|
||||
const navLink = navNode.querySelector('.' + Selectors.classes.navlink);
|
||||
navNode.setAttribute('prev-role', navNode.getAttribute('role'));
|
||||
navNode.setAttribute('role', 'menuitem');
|
||||
|
||||
// If there are navLinks that contain an active link in the moreDropdown
|
||||
// make the dropdownToggle in the moreButton active.
|
||||
if (navLink.classList.contains(Selectors.classes.active)) {
|
||||
@ -153,14 +149,6 @@ const moveOutOfMoreDropdown = (menu, navNode) => {
|
||||
const dropdownToggle = menu.querySelector('.' + Selectors.classes.dropdowntoggle);
|
||||
const navLink = navNode.querySelector('.' + Selectors.classes.dropdownitem);
|
||||
|
||||
navNode.setAttribute('role', navNode.getAttribute('prev-role'));
|
||||
if (navLink) {
|
||||
const currentAttribute = navLink.getAttribute('role');
|
||||
if (currentAttribute === 'menuitem') {
|
||||
navLink.removeAttribute('role');
|
||||
}
|
||||
}
|
||||
|
||||
// Stop displaying the active state on the dropdownToggle if
|
||||
// the active navlink is removed.
|
||||
if (navLink.classList.contains(Selectors.classes.active)) {
|
||||
@ -198,12 +186,12 @@ export default menu => {
|
||||
}
|
||||
// Populate the more dropdown menu with additional nodes if necessary, depending on the current screen size.
|
||||
autoCollapse(menu);
|
||||
keyboard_navigation(menu);
|
||||
menu_navigation(menu);
|
||||
|
||||
// When the screen size changes make sure the menu still fits.
|
||||
window.addEventListener('resize', () => {
|
||||
autoCollapse(menu);
|
||||
keyboard_navigation(menu);
|
||||
menu_navigation(menu);
|
||||
});
|
||||
|
||||
const toggledropdown = e => {
|
||||
|
@ -17,7 +17,6 @@
|
||||
* Initializes and handles events in the user menu.
|
||||
*
|
||||
* @module core/usermenu
|
||||
* @package core
|
||||
* @copyright 2021 Moodle
|
||||
* @author Mihail Geshoski <mihail@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
|
@ -33,7 +33,6 @@ class more_menu implements renderable, templatable {
|
||||
|
||||
protected $content;
|
||||
protected $navbarstyle;
|
||||
protected $hastabs;
|
||||
protected $haschildren;
|
||||
|
||||
/**
|
||||
@ -41,13 +40,11 @@ class more_menu implements renderable, templatable {
|
||||
*
|
||||
* @param object $content Navigation objects.
|
||||
* @param string $navbarstyle class name.
|
||||
* @param bool $hastabs If tabs are being used.
|
||||
* @param bool $haschildren The content has children.
|
||||
*/
|
||||
public function __construct(object $content, string $navbarstyle, bool $hastabs = false, bool $haschildren = true) {
|
||||
public function __construct(object $content, string $navbarstyle, bool $haschildren = true) {
|
||||
$this->content = $content;
|
||||
$this->navbarstyle = $navbarstyle;
|
||||
$this->hastabs = $hastabs;
|
||||
$this->haschildren = $haschildren;
|
||||
}
|
||||
|
||||
@ -58,7 +55,7 @@ class more_menu implements renderable, templatable {
|
||||
* @return array Data for rendering a template
|
||||
*/
|
||||
public function export_for_template(renderer_base $output): array {
|
||||
$data = ['navbarstyle' => $this->navbarstyle, 'tabs' => $this->hastabs];
|
||||
$data = ['navbarstyle' => $this->navbarstyle];
|
||||
if ($this->haschildren) {
|
||||
if (!isset($this->content->children) || count($this->content->children) == 0) {
|
||||
$data = [];
|
||||
|
@ -56,7 +56,7 @@ class primary implements renderable, templatable {
|
||||
}
|
||||
|
||||
$menudata = (object) array_merge($this->get_primary_nav(), $this->get_custom_menu($output));
|
||||
$moremenu = new \core\navigation\output\more_menu($menudata, 'navbar-nav', false, false);
|
||||
$moremenu = new \core\navigation\output\more_menu($menudata, 'navbar-nav', false);
|
||||
|
||||
return [
|
||||
'moremenu' => $moremenu->export_for_template($output),
|
||||
|
@ -50,7 +50,7 @@
|
||||
{{^haschildren}}
|
||||
<li class="nav-item" role="none" data-forceintomoremenu="{{#forceintomoremenu}}true{{/forceintomoremenu}}{{^forceintomoremenu}}false{{/forceintomoremenu}}">
|
||||
{{#tab}}
|
||||
<a role="menuitem" class="nav-link {{#isactive}}active{{/isactive}} {{#classes}}{{.}} {{/classes}}" href="{{tab}}" data-toggle="tab" aria-selected="false" tabindex="-1">
|
||||
<a role="menuitem" class="nav-link {{#isactive}}active{{/isactive}} {{#classes}}{{.}} {{/classes}}" href="{{tab}}" data-toggle="tab" aria-current="false" tabindex="-1">
|
||||
{{{text}}}
|
||||
</a>
|
||||
{{/tab}}
|
||||
|
@ -61,7 +61,7 @@
|
||||
{{/secondarynavigation}}
|
||||
|
||||
<div class="tab-content mt-3">
|
||||
<div class="tab-pane active" id="link{{node.key}}" role="tabpanel">
|
||||
<div class="tab-pane active" id="link{{node.key}}" {{^secondarynavigation}}role="tabpanel"{{/secondarynavigation}}>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
@ -105,7 +105,7 @@
|
||||
</div>
|
||||
{{#node.children}}
|
||||
{{#children.count}}
|
||||
<div class="tab-pane" id="link{{key}}" role="tabpanel">
|
||||
<div class="tab-pane" id="link{{key}}" {{^secondarynavigation}}role="tabpanel"{{/secondarynavigation}}>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
|
@ -63,31 +63,30 @@
|
||||
{{/unauthenticateduser}}
|
||||
{{^unauthenticateduser}}
|
||||
<div class="dropdown show">
|
||||
<a href="#" role="button" id="user-menu-toggle" data-toggle="dropdown" aria-label="{{#str}}usermenu{{/str}}"
|
||||
<button type="button" id="user-menu-toggle" data-toggle="dropdown" aria-label="{{#str}}usermenu{{/str}}"
|
||||
aria-haspopup="true" aria-controls="user-action-menu" class="btn dropdown-toggle">
|
||||
<span class="userbutton">
|
||||
{{> core/user_menu_metadata }}
|
||||
</span>
|
||||
<b class="caret"></b>
|
||||
</a>
|
||||
<div aria-label="{{#str}}user{{/str}}" id="user-action-menu" class="dropdown-menu dropdown-menu-right">
|
||||
</button>
|
||||
<div id="user-action-menu" class="dropdown-menu dropdown-menu-right">
|
||||
<div id="usermenu-carousel" class="carousel slide" data-touch="false" data-interval="false" data-keyboard="false">
|
||||
<div class="carousel-inner">
|
||||
<div id="carousel-item-main" class="carousel-item active" role="menu" tabindex="-1" aria-label="{{#str}}usermenu{{/str}}">
|
||||
<div id="carousel-item-main" class="carousel-item active" role="menu" tabindex="-1" aria-label="{{#str}}user{{/str}}">
|
||||
{{> core/user_action_menu_items }}
|
||||
</div>
|
||||
{{#submenus}}
|
||||
<div id="carousel-item-{{id}}" class="carousel-item submenu" tabindex="-1" aria-label="{{title}}">
|
||||
<div class="d-flex flex-column h-100">
|
||||
<div class="header">
|
||||
<a href="#" class="carousel-navigation-link text-decoration-none text-body" data-carousel-target-id="carousel-item-main" aria-label="{{#str}}usermenugoback{{/str}}">
|
||||
<button type="#" class="btn btn-icon carousel-navigation-link text-decoration-none text-body" data-carousel-target-id="carousel-item-main" aria-label="{{#str}}usermenugoback{{/str}}">
|
||||
<span class="dir-rtl-hide">{{#pix}}i/arrow-left{{/pix}}</span>
|
||||
<span class="dir-ltr-hide">{{#pix}}i/arrow-right{{/pix}}</span>
|
||||
</a>
|
||||
<span class="pl-2">{{title}}</span>
|
||||
</button>
|
||||
<span class="pl-2" id="carousel-item-title-{{id}}">{{title}}</span>
|
||||
</div>
|
||||
<div class="dropdown-divider"></div>
|
||||
<div class="items h-100 overflow-auto" role="menu">
|
||||
<div class="items h-100 overflow-auto" role="menu" aria-labelledby="carousel-item-title-{{id}}">
|
||||
{{> core/user_action_menu_submenu_items }}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -165,7 +165,7 @@ class behat_navigation extends behat_base {
|
||||
|
||||
if ($this->running_javascript()) {
|
||||
// The user menu must be expanded when JS is enabled.
|
||||
$xpath = "//div[contains(concat(' ', @class, ' '), ' usermenu ')]//a[contains(concat(' ', @class, ' '), ' dropdown-toggle ')]";
|
||||
$xpath = "//div[contains(concat(' ', @class, ' '), ' usermenu ')]//button[contains(concat(' ', @class, ' '), ' dropdown-toggle ')]";
|
||||
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
|
||||
}
|
||||
|
||||
@ -959,15 +959,19 @@ class behat_navigation extends behat_base {
|
||||
array_shift($parentnodes);
|
||||
} else if (count($menubuttons) > 0) {
|
||||
try {
|
||||
$this->execute('behat_general::i_click_on', [$menubuttons[1], 'NodeElement']);
|
||||
$menubuttons[0]->isVisible();
|
||||
try {
|
||||
$this->execute('behat_general::i_click_on', [$menubuttons[1], 'NodeElement']);
|
||||
} catch (Exception $e) {
|
||||
$this->execute('behat_general::i_click_on', [$menubuttons[0], 'NodeElement']);
|
||||
}
|
||||
$moreitemxpath = '//ul[@data-region=\'moredropdown\']/li/a[contains(normalize-space(.), ' . $tabname . ')]';
|
||||
if ($morenode = $this->getSession()->getPage()->find('xpath', $moreitemxpath)) {
|
||||
$this->execute('behat_general::i_click_on', [$morenode, 'NodeElement']);
|
||||
$xpath .= '//div[contains(@class,\'active\')]';
|
||||
array_shift($parentnodes);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->execute('behat_general::i_click_on', [$menubuttons[0], 'NodeElement']);
|
||||
}
|
||||
$moreitemxpath = '//ul[@data-region=\'moredropdown\']/li/a[contains(normalize-space(.), ' . $tabname . ')]';
|
||||
if ($morenode = $this->getSession()->getPage()->find('xpath', $moreitemxpath)) {
|
||||
$this->execute('behat_general::i_click_on', [$morenode, 'NodeElement']);
|
||||
$xpath .= '//div[contains(@class,\'active\')]';
|
||||
array_shift($parentnodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user