Merge branch 'MDL-79458-master' of https://github.com/ferranrecio/moodle

This commit is contained in:
Ilya Tregubov 2023-10-02 13:30:07 +08:00
commit c80e366051
No known key found for this signature in database
GPG Key ID: 0F58186F748E55C1
12 changed files with 35 additions and 11 deletions

View File

@ -35,7 +35,6 @@ Feature: Edit activities in main menu block
| activity | course | section | name |
| forum | Acceptance test site | 0 | Visible forum |
| forum | Acceptance test site | 0 | My forum name |
And I change window size to "large"
And I log in as "admin"
And I am on site homepage
And I turn editing mode on

View File

@ -99,7 +99,6 @@ Feature: Toggle activities visibility from the course page
Scenario: Activities can be made available but not visible on a course page
Given the following config values are set as admin:
| allowstealth | 1 |
And I change window size to "large"
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I open "Test assignment name" actions menu

View File

@ -39,7 +39,6 @@ Feature: We can change what we are viewing on the grader report
@javascript
Scenario: View and minimise the grader report containing hidden activities
When I am on "Course 1" course homepage with editing mode on
And I change window size to "large"
And I open "Test assignment name 2" actions menu
And I choose "Availability > Hide on course page" in the open action menu
And I am on "Course 1" course homepage with editing mode off

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
define("core/pagehelpers",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.previousFocusableElement=_exports.nextFocusableElement=_exports.lastFocusableElement=_exports.isSmall=_exports.isLarge=_exports.isExtraSmall=_exports.getCurrentWidth=_exports.focusableElements=_exports.firstFocusableElement=void 0;
define("core/pagehelpers",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.previousFocusableElement=_exports.nextFocusableElement=_exports.lastFocusableElement=_exports.isSmall=_exports.isLarge=_exports.isExtraSmall=_exports.isBehatSite=_exports.getCurrentWidth=_exports.focusableElements=_exports.firstFocusableElement=void 0;
/**
* Page utility helpers.
*
@ -6,6 +6,6 @@ define("core/pagehelpers",["exports"],(function(_exports){Object.defineProperty(
* @copyright 2023 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
const Sizes_small=576,Sizes_medium=991,Sizes_large=1400,Selectors_focusable='a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])',getCurrentWidth=()=>{const DomRect=document.body.getBoundingClientRect();return DomRect.x+DomRect.width};_exports.getCurrentWidth=getCurrentWidth;_exports.isExtraSmall=()=>getCurrentWidth()<Sizes_small;_exports.isSmall=()=>getCurrentWidth()<Sizes_medium;_exports.isLarge=()=>getCurrentWidth()>=Sizes_large;_exports.firstFocusableElement=container=>(container||document).querySelector(Selectors_focusable);_exports.lastFocusableElement=container=>{var _focusableElements;const focusableElements=(container||document).querySelectorAll(Selectors_focusable);return null!==(_focusableElements=focusableElements[focusableElements.length-1])&&void 0!==_focusableElements?_focusableElements:null};const focusableElements=container=>(container||document).querySelectorAll(Selectors_focusable);_exports.focusableElements=focusableElements;_exports.previousFocusableElement=(container,loopSelection)=>getRelativeFocusableElement(container,loopSelection,-1);_exports.nextFocusableElement=(container,loopSelection)=>getRelativeFocusableElement(container,loopSelection,1);const getRelativeFocusableElement=(container,loopSelection,direction)=>{var _focusables;const focusedElement=document.activeElement,focusables=[...focusableElements(container)],focusedIndex=focusables.indexOf(focusedElement);if(-1===focusedIndex)return null;const newIndex=focusedIndex+direction;return void 0!==focusables[newIndex]?focusables[newIndex]:1!=loopSelection?null:direction>0?null!==(_focusables$=focusables[0])&&void 0!==_focusables$?_focusables$:null:null!==(_focusables=focusables[focusables.length-1])&&void 0!==_focusables?_focusables:null;var _focusables$}}));
const Sizes_small=576,Sizes_medium=991,Sizes_large=1400,Selectors_focusable='a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])',Classes_behatSite="behat-site";_exports.isBehatSite=()=>document.body.classList.contains(Classes_behatSite);const getCurrentWidth=()=>{const DomRect=document.body.getBoundingClientRect();return DomRect.x+DomRect.width};_exports.getCurrentWidth=getCurrentWidth;_exports.isExtraSmall=()=>getCurrentWidth()<Sizes_small;_exports.isSmall=()=>getCurrentWidth()<Sizes_medium;_exports.isLarge=()=>getCurrentWidth()>=Sizes_large;_exports.firstFocusableElement=container=>(container||document).querySelector(Selectors_focusable);_exports.lastFocusableElement=container=>{var _focusableElements;const focusableElements=(container||document).querySelectorAll(Selectors_focusable);return null!==(_focusableElements=focusableElements[focusableElements.length-1])&&void 0!==_focusableElements?_focusableElements:null};const focusableElements=container=>(container||document).querySelectorAll(Selectors_focusable);_exports.focusableElements=focusableElements;_exports.previousFocusableElement=(container,loopSelection)=>getRelativeFocusableElement(container,loopSelection,-1);_exports.nextFocusableElement=(container,loopSelection)=>getRelativeFocusableElement(container,loopSelection,1);const getRelativeFocusableElement=(container,loopSelection,direction)=>{var _focusables;const focusedElement=document.activeElement,focusables=[...focusableElements(container)],focusedIndex=focusables.indexOf(focusedElement);if(-1===focusedIndex)return null;const newIndex=focusedIndex+direction;return void 0!==focusables[newIndex]?focusables[newIndex]:1!=loopSelection?null:direction>0?null!==(_focusables$=focusables[0])&&void 0!==_focusables$?_focusables$:null:null!==(_focusables=focusables[focusables.length-1])&&void 0!==_focusables?_focusables:null;var _focusables$}}));
//# sourceMappingURL=pagehelpers.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -24,6 +24,7 @@
import jQuery from 'jquery';
import {debounce} from 'core/utils';
import {
isBehatSite,
isExtraSmall,
firstFocusableElement,
previousFocusableElement,
@ -118,8 +119,12 @@ class SubPanel {
// Menu Item events.
this.menuItem.addEventListener('click', this._menuItemClickHandler.bind(this));
this.menuItem.addEventListener('keydown', this._menuItemKeyHandler.bind(this));
this.menuItem.addEventListener('mouseover', this._menuItemHoverHandler.bind(this));
this.menuItem.addEventListener('mouseout', this._menuItemHoverOutHandler.bind(this));
if (!isBehatSite()) {
// Behat in Chrome usually move the mouse over the page when trying clicking a subpanel element.
// If the menu has more than one subpanel this could cause closing the subpanel by mistake.
this.menuItem.addEventListener('mouseover', this._menuItemHoverHandler.bind(this));
this.menuItem.addEventListener('mouseout', this._menuItemHoverOutHandler.bind(this));
}
// Subpanel content events.
this.panelContent.addEventListener('keydown', this._panelContentKeyHandler.bind(this));

View File

@ -34,7 +34,19 @@ const Sizes = {
};
const Selectors = {
focusable: 'a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
focusable: 'a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])',
};
const Classes = {
behatSite: 'behat-site',
};
/**
* Check fi the current page is a Behat site.
* @returns {boolean} true if the current page is a Behat site.
*/
export const isBehatSite = () => {
return document.body.classList.contains(Classes.behatSite);
};
/**

View File

@ -45,6 +45,10 @@ $font-size-xs: ($font-size-base * .75) !default;
@media (prefers-reduced-motion: reduce) {
animation: none;
}
body.behat-site & {
animation: none;
}
}
.context-header-settings-menu .dropdown-toggle > .icon,

View File

@ -26036,6 +26036,9 @@ blockquote {
animation: none;
}
}
body.behat-site .action-menu .dropdown-subpanel-content.show {
animation: none;
}
.action-menu .dropdown-subpanel .dropdown-item::after {
border: 0;
content: "\f054";

View File

@ -26036,6 +26036,9 @@ blockquote {
animation: none;
}
}
body.behat-site .action-menu .dropdown-subpanel-content.show {
animation: none;
}
.action-menu .dropdown-subpanel .dropdown-item::after {
border: 0;
content: "\f054";