MDL-67663 mod_forum: Show/hide elements from screen reader on search
* When the search input gets shown, users can still navigate on the close button and the grading status container which can cause confusion among users. So hide and show them accordingly as well. * Hide/show user picker and body container when the search results container is shown/hidden.
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
define ("mod_forum/local/grades/local/grader/selectors",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var b=function(a,b){return"[data-".concat(a,"=\"").concat(b,"\"]")},c={buttons:{toggleFullscreen:b("action","togglefullscreen"),closeGrader:b("action","closegrader"),saveGrade:b("action","savegrade"),selectUser:b("action","select-user"),toggleSearch:b("action","toggle-search")},regions:{bodyContainer:b("region","body-container"),moduleContainer:b("region","module_content_container"),moduleReplace:b("region","module_content"),pickerRegion:b("region","user_picker"),gradingPanel:b("region","grade"),gradingPanelContainer:b("region","grading-panel-container"),gradingPanelErrors:b("region","grade-errors"),searchResultsContainer:b("region","search-results-container"),statusContainer:b("region","status-container"),userSearchContainer:b("region","user-search-container"),userSearchInput:b("region","user-search-input")},values:{sendStudentNotifications:"[data-region=\"notification\"] input[type=\"radio\"]:checked"}};a.default=c;return a.default});
|
||||
define ("mod_forum/local/grades/local/grader/selectors",["exports"],function(a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;var b=function(a,b){return"[data-".concat(a,"=\"").concat(b,"\"]")},c={buttons:{toggleFullscreen:b("action","togglefullscreen"),closeGrader:b("action","closegrader"),collapseGradingDrawer:b("action","collapse-grading-drawer"),saveGrade:b("action","savegrade"),selectUser:b("action","select-user"),toggleSearch:b("action","toggle-search")},regions:{bodyContainer:b("region","body-container"),moduleContainer:b("region","module_content_container"),moduleReplace:b("region","module_content"),pickerRegion:b("region","user_picker"),gradingInfoContainer:b("region","grading-info-container"),gradingPanel:b("region","grade"),gradingPanelContainer:b("region","grading-panel-container"),gradingPanelErrors:b("region","grade-errors"),searchResultsContainer:b("region","search-results-container"),statusContainer:b("region","status-container"),userSearchContainer:b("region","user-search-container"),userSearchInput:b("region","user-search-input")},values:{sendStudentNotifications:"[data-region=\"notification\"] input[type=\"radio\"]:checked"}};a.default=c;return a.default});
|
||||
//# sourceMappingURL=selectors.min.js.map
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/local/grades/local/grader/selectors.js"],"names":["getDataSelector","name","value","buttons","toggleFullscreen","closeGrader","saveGrade","selectUser","toggleSearch","regions","bodyContainer","moduleContainer","moduleReplace","pickerRegion","gradingPanel","gradingPanelContainer","gradingPanelErrors","searchResultsContainer","statusContainer","userSearchContainer","userSearchInput","values","sendStudentNotifications"],"mappings":"kKA8BMA,CAAAA,CAAe,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAiB,CACrC,sBAAgBD,CAAhB,eAAyBC,CAAzB,OACH,C,GAEc,CACXC,OAAO,CAAE,CACLC,gBAAgB,CAAEJ,CAAe,CAAC,QAAD,CAAW,kBAAX,CAD5B,CAELK,WAAW,CAAEL,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLM,SAAS,CAAEN,CAAe,CAAC,QAAD,CAAW,WAAX,CAHrB,CAILO,UAAU,CAAEP,CAAe,CAAC,QAAD,CAAW,aAAX,CAJtB,CAKLQ,YAAY,CAAER,CAAe,CAAC,QAAD,CAAW,eAAX,CALxB,CADE,CAQXS,OAAO,CAAE,CACLC,aAAa,CAAEV,CAAe,CAAC,QAAD,CAAW,gBAAX,CADzB,CAELW,eAAe,CAAEX,CAAe,CAAC,QAAD,CAAW,0BAAX,CAF3B,CAGLY,aAAa,CAAEZ,CAAe,CAAC,QAAD,CAAW,gBAAX,CAHzB,CAILa,YAAY,CAAEb,CAAe,CAAC,QAAD,CAAW,aAAX,CAJxB,CAKLc,YAAY,CAAEd,CAAe,CAAC,QAAD,CAAW,OAAX,CALxB,CAMLe,qBAAqB,CAAEf,CAAe,CAAC,QAAD,CAAW,yBAAX,CANjC,CAOLgB,kBAAkB,CAAEhB,CAAe,CAAC,QAAD,CAAW,cAAX,CAP9B,CAQLiB,sBAAsB,CAAEjB,CAAe,CAAC,QAAD,CAAW,0BAAX,CARlC,CASLkB,eAAe,CAAElB,CAAe,CAAC,QAAD,CAAW,kBAAX,CAT3B,CAULmB,mBAAmB,CAAEnB,CAAe,CAAC,QAAD,CAAW,uBAAX,CAV/B,CAWLoB,eAAe,CAAEpB,CAAe,CAAC,QAAD,CAAW,mBAAX,CAX3B,CARE,CAqBXqB,MAAM,CAAE,CACJC,wBAAwB,CAAE,8DADtB,CArBG,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Define all of the selectors we will be using on the grading interface.\n *\n * @module mod_forum/local/grades/local/grader/selectors\n * @package mod_forum\n * @copyright 2019 Mathew May <mathew.solutions>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * A small helper function to build queryable data selectors.\n * @param {String} name\n * @param {String} value\n * @return {string}\n */\nconst getDataSelector = (name, value) => {\n return `[data-${name}=\"${value}\"]`;\n};\n\nexport default {\n buttons: {\n toggleFullscreen: getDataSelector('action', 'togglefullscreen'),\n closeGrader: getDataSelector('action', 'closegrader'),\n saveGrade: getDataSelector('action', 'savegrade'),\n selectUser: getDataSelector('action', 'select-user'),\n toggleSearch: getDataSelector('action', 'toggle-search')\n },\n regions: {\n bodyContainer: getDataSelector('region', 'body-container'),\n moduleContainer: getDataSelector('region', 'module_content_container'),\n moduleReplace: getDataSelector('region', 'module_content'),\n pickerRegion: getDataSelector('region', 'user_picker'),\n gradingPanel: getDataSelector('region', 'grade'),\n gradingPanelContainer: getDataSelector('region', 'grading-panel-container'),\n gradingPanelErrors: getDataSelector('region', 'grade-errors'),\n searchResultsContainer: getDataSelector('region', 'search-results-container'),\n statusContainer: getDataSelector('region', 'status-container'),\n userSearchContainer: getDataSelector('region', 'user-search-container'),\n userSearchInput: getDataSelector('region', 'user-search-input')\n },\n values: {\n sendStudentNotifications: '[data-region=\"notification\"] input[type=\"radio\"]:checked',\n }\n};\n\n"],"file":"selectors.min.js"}
|
||||
{"version":3,"sources":["../../../../../src/local/grades/local/grader/selectors.js"],"names":["getDataSelector","name","value","buttons","toggleFullscreen","closeGrader","collapseGradingDrawer","saveGrade","selectUser","toggleSearch","regions","bodyContainer","moduleContainer","moduleReplace","pickerRegion","gradingInfoContainer","gradingPanel","gradingPanelContainer","gradingPanelErrors","searchResultsContainer","statusContainer","userSearchContainer","userSearchInput","values","sendStudentNotifications"],"mappings":"kKA8BMA,CAAAA,CAAe,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAiB,CACrC,sBAAgBD,CAAhB,eAAyBC,CAAzB,OACH,C,GAEc,CACXC,OAAO,CAAE,CACLC,gBAAgB,CAAEJ,CAAe,CAAC,QAAD,CAAW,kBAAX,CAD5B,CAELK,WAAW,CAAEL,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLM,qBAAqB,CAAEN,CAAe,CAAC,QAAD,CAAW,yBAAX,CAHjC,CAILO,SAAS,CAAEP,CAAe,CAAC,QAAD,CAAW,WAAX,CAJrB,CAKLQ,UAAU,CAAER,CAAe,CAAC,QAAD,CAAW,aAAX,CALtB,CAMLS,YAAY,CAAET,CAAe,CAAC,QAAD,CAAW,eAAX,CANxB,CADE,CASXU,OAAO,CAAE,CACLC,aAAa,CAAEX,CAAe,CAAC,QAAD,CAAW,gBAAX,CADzB,CAELY,eAAe,CAAEZ,CAAe,CAAC,QAAD,CAAW,0BAAX,CAF3B,CAGLa,aAAa,CAAEb,CAAe,CAAC,QAAD,CAAW,gBAAX,CAHzB,CAILc,YAAY,CAAEd,CAAe,CAAC,QAAD,CAAW,aAAX,CAJxB,CAKLe,oBAAoB,CAAEf,CAAe,CAAC,QAAD,CAAW,wBAAX,CALhC,CAMLgB,YAAY,CAAEhB,CAAe,CAAC,QAAD,CAAW,OAAX,CANxB,CAOLiB,qBAAqB,CAAEjB,CAAe,CAAC,QAAD,CAAW,yBAAX,CAPjC,CAQLkB,kBAAkB,CAAElB,CAAe,CAAC,QAAD,CAAW,cAAX,CAR9B,CASLmB,sBAAsB,CAAEnB,CAAe,CAAC,QAAD,CAAW,0BAAX,CATlC,CAULoB,eAAe,CAAEpB,CAAe,CAAC,QAAD,CAAW,kBAAX,CAV3B,CAWLqB,mBAAmB,CAAErB,CAAe,CAAC,QAAD,CAAW,uBAAX,CAX/B,CAYLsB,eAAe,CAAEtB,CAAe,CAAC,QAAD,CAAW,mBAAX,CAZ3B,CATE,CAuBXuB,MAAM,CAAE,CACJC,wBAAwB,CAAE,8DADtB,CAvBG,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Define all of the selectors we will be using on the grading interface.\n *\n * @module mod_forum/local/grades/local/grader/selectors\n * @package mod_forum\n * @copyright 2019 Mathew May <mathew.solutions>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * A small helper function to build queryable data selectors.\n * @param {String} name\n * @param {String} value\n * @return {string}\n */\nconst getDataSelector = (name, value) => {\n return `[data-${name}=\"${value}\"]`;\n};\n\nexport default {\n buttons: {\n toggleFullscreen: getDataSelector('action', 'togglefullscreen'),\n closeGrader: getDataSelector('action', 'closegrader'),\n collapseGradingDrawer: getDataSelector('action', 'collapse-grading-drawer'),\n saveGrade: getDataSelector('action', 'savegrade'),\n selectUser: getDataSelector('action', 'select-user'),\n toggleSearch: getDataSelector('action', 'toggle-search')\n },\n regions: {\n bodyContainer: getDataSelector('region', 'body-container'),\n moduleContainer: getDataSelector('region', 'module_content_container'),\n moduleReplace: getDataSelector('region', 'module_content'),\n pickerRegion: getDataSelector('region', 'user_picker'),\n gradingInfoContainer: getDataSelector('region', 'grading-info-container'),\n gradingPanel: getDataSelector('region', 'grade'),\n gradingPanelContainer: getDataSelector('region', 'grading-panel-container'),\n gradingPanelErrors: getDataSelector('region', 'grade-errors'),\n searchResultsContainer: getDataSelector('region', 'search-results-container'),\n statusContainer: getDataSelector('region', 'status-container'),\n userSearchContainer: getDataSelector('region', 'user-search-container'),\n userSearchInput: getDataSelector('region', 'user-search-input')\n },\n values: {\n sendStudentNotifications: '[data-region=\"notification\"] input[type=\"radio\"]:checked',\n }\n};\n\n"],"file":"selectors.min.js"}
|
||||
@@ -158,6 +158,16 @@ const showUserSearchInput = (toggleSearchButton, searchContainer, searchInput) =
|
||||
toggleSearchButton.setAttribute('aria-expanded', 'true');
|
||||
toggleSearchButton.classList.add('expand');
|
||||
toggleSearchButton.classList.remove('collapse');
|
||||
|
||||
// Hide the grading info container from screen reader.
|
||||
const gradingInfoContainer = searchContainer.parentElement.querySelector(Selectors.regions.gradingInfoContainer);
|
||||
gradingInfoContainer.setAttribute('aria-hidden', 'true');
|
||||
|
||||
// Hide the collapse grading drawer button from screen reader.
|
||||
const collapseGradingDrawer = searchContainer.parentElement.querySelector(Selectors.buttons.collapseGradingDrawer);
|
||||
collapseGradingDrawer.setAttribute('aria-hidden', 'true');
|
||||
collapseGradingDrawer.setAttribute('tabindex', '-1');
|
||||
|
||||
searchInput.focus();
|
||||
};
|
||||
|
||||
@@ -174,6 +184,16 @@ const hideUserSearchInput = (toggleSearchButton, searchContainer, searchInput) =
|
||||
toggleSearchButton.classList.add('collapse');
|
||||
toggleSearchButton.classList.remove('expand');
|
||||
toggleSearchButton.focus();
|
||||
|
||||
// Show the grading info container to screen reader.
|
||||
const gradingInfoContainer = searchContainer.parentElement.querySelector(Selectors.regions.gradingInfoContainer);
|
||||
gradingInfoContainer.removeAttribute('aria-hidden');
|
||||
|
||||
// Show the collapse grading drawer button from screen reader.
|
||||
const collapseGradingDrawer = searchContainer.parentElement.querySelector(Selectors.buttons.collapseGradingDrawer);
|
||||
collapseGradingDrawer.removeAttribute('aria-hidden');
|
||||
collapseGradingDrawer.setAttribute('tabindex', '0');
|
||||
|
||||
searchInput.value = '';
|
||||
};
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ export default {
|
||||
buttons: {
|
||||
toggleFullscreen: getDataSelector('action', 'togglefullscreen'),
|
||||
closeGrader: getDataSelector('action', 'closegrader'),
|
||||
collapseGradingDrawer: getDataSelector('action', 'collapse-grading-drawer'),
|
||||
saveGrade: getDataSelector('action', 'savegrade'),
|
||||
selectUser: getDataSelector('action', 'select-user'),
|
||||
toggleSearch: getDataSelector('action', 'toggle-search')
|
||||
@@ -45,6 +46,7 @@ export default {
|
||||
moduleContainer: getDataSelector('region', 'module_content_container'),
|
||||
moduleReplace: getDataSelector('region', 'module_content'),
|
||||
pickerRegion: getDataSelector('region', 'user_picker'),
|
||||
gradingInfoContainer: getDataSelector('region', 'grading-info-container'),
|
||||
gradingPanel: getDataSelector('region', 'grade'),
|
||||
gradingPanelContainer: getDataSelector('region', 'grading-panel-container'),
|
||||
gradingPanelErrors: getDataSelector('region', 'grade-errors'),
|
||||
|
||||
@@ -39,13 +39,14 @@
|
||||
<div class="h-100 w-100 bg-white d-flex flex-column" role="region" aria-label="{{#str}} forumgradingpanel, mod_forum {{/str}}">
|
||||
<div class="flex-shrink-0 d-flex flex-column">
|
||||
<div class="header-container bg-light">
|
||||
<div class="info-container d-flex align-items-center">
|
||||
<div class="info-container d-flex align-items-center" data-region="grading-info-container">
|
||||
<button
|
||||
class="btn btn-icon icon-size-3 icon-no-margin colour-inherit"
|
||||
data-action="collapse-grading-drawer"
|
||||
aria-controls="grading-drawer-{{uniqid}}"
|
||||
aria-expanded="true"
|
||||
title="{{#str}} closebuttontitle, core {{/str}}"
|
||||
aria-label="{{#str}} hidegraderpanel, mod_forum {{/str}}"
|
||||
>
|
||||
<span class="dir-ltr-hide">{{#pix}} t/left, core {{/pix}}</span>
|
||||
<span class="dir-rtl-hide">{{#pix}} t/right, core {{/pix}}</span>
|
||||
@@ -77,13 +78,11 @@
|
||||
aria-controls="searchbox-{{uniqid}}"
|
||||
data-action="toggle-search"
|
||||
>
|
||||
<div class="expanded-icon">
|
||||
<span aria-hidden="true">{{#pix}} e/cancel, core, {{#str}} hideusersearch, mod_forum {{/str}} {{/pix}}</span>
|
||||
<span class="sr-only">{{#str}} hideusersearch, mod_forum {{/str}}</span>
|
||||
<div class="expanded-icon" data-region="user-search-icon-hide">
|
||||
<span>{{#pix}} e/cancel, core, {{#str}} hideusersearch, mod_forum {{/str}} {{/pix}}</span>
|
||||
</div>
|
||||
<div class="collapsed-icon">
|
||||
<span aria-hidden="true">{{#pix}} i/search, core, {{#str}} showusersearch, mod_forum {{/str}} {{/pix}}</span>
|
||||
<span class="sr-only">{{#str}} showusersearch, mod_forum {{/str}}</span>
|
||||
<div class="collapsed-icon" data-region="user-search-icon-show">
|
||||
<span>{{#pix}} i/search, core, {{#str}} showusersearch, mod_forum {{/str}} {{/pix}}</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user