MDL-67663 core: Do not use aria-hidden="false" on drawer

From https://www.w3.org/TR/wai-aria-1.1/#aria-hidden:
* "aria-hidden="false" is known to work inconsistently in browsers"
This commit is contained in:
Jun Pataleta 2020-04-01 11:33:38 +08:00
parent 0d3a580e03
commit 9183c0c91a
4 changed files with 4 additions and 4 deletions

View File

@ -1,2 +1,2 @@
define ("core/drawer",["exports","jquery","core/pubsub","core/drawer_events"],function(a,b,c,d){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=e(b);c=function(a){if(a&&a.__esModule){return a}else{var b={};if(null!=a){for(var c in a){if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};if(d.get||d.set){Object.defineProperty(b,c,d)}else{b[c]=a[c]}}}}b.default=a;return b}}(c);d=e(d);function e(a){return a&&a.__esModule?a:{default:a}}var f=function(a){a.removeClass("hidden");a.attr("aria-expanded",!0);a.attr("aria-hidden",!1);a.focus();c.publish(d.default.DRAWER_SHOWN,a)},g=function(a){a.addClass("hidden");a.attr("aria-expanded",!1);a.attr("aria-hidden",!0);c.publish(d.default.DRAWER_HIDDEN,a)},h=function(a){var b=a.hasClass("hidden");return!b},i=function(a){if(h(a)){g(a)}else{f(a)}},j=function(a){a=(0,b.default)(a);return a.closest("[data-region=\"right-hand-drawer\"]")};a.default={hide:g,show:f,isVisible:h,toggle:i,registerToggles:function registerToggles(a,b){var c=null;b.attr("aria-expanded",h(a));b.on("click",function(d){d.preventDefault();var e=h(a);i(a);b.attr("aria-expanded",!e);if(!e){c=b.filter(function(a,b){return b==d.target||b.contains(d.target)})}else if(c){c.focus();c=null}})},getDrawerRoot:j};return a.default}); define ("core/drawer",["exports","jquery","core/pubsub","core/drawer_events"],function(a,b,c,d){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=e(b);c=function(a){if(a&&a.__esModule){return a}else{var b={};if(null!=a){for(var c in a){if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};if(d.get||d.set){Object.defineProperty(b,c,d)}else{b[c]=a[c]}}}}b.default=a;return b}}(c);d=e(d);function e(a){return a&&a.__esModule?a:{default:a}}var f=function(a){a.removeClass("hidden");a.attr("aria-expanded",!0);a.removeAttr("aria-hidden");a.focus();c.publish(d.default.DRAWER_SHOWN,a)},g=function(a){a.addClass("hidden");a.attr("aria-expanded",!1);a.attr("aria-hidden",!0);c.publish(d.default.DRAWER_HIDDEN,a)},h=function(a){var b=a.hasClass("hidden");return!b},i=function(a){if(h(a)){g(a)}else{f(a)}},j=function(a){a=(0,b.default)(a);return a.closest("[data-region=\"right-hand-drawer\"]")};a.default={hide:g,show:f,isVisible:h,toggle:i,registerToggles:function registerToggles(a,b){var c=null;b.attr("aria-expanded",h(a));b.on("click",function(d){d.preventDefault();var e=h(a);i(a);b.attr("aria-expanded",!e);if(!e){c=b.filter(function(a,b){return b==d.target||b.contains(d.target)})}else if(c){c.focus();c=null}})},getDrawerRoot:j};return a.default});
//# sourceMappingURL=drawer.min.js.map //# sourceMappingURL=drawer.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -32,7 +32,7 @@ import DrawerEvents from 'core/drawer_events';
const show = (root) => { const show = (root) => {
root.removeClass('hidden'); root.removeClass('hidden');
root.attr('aria-expanded', true); root.attr('aria-expanded', true);
root.attr('aria-hidden', false); root.removeAttr('aria-hidden');
root.focus(); root.focus();
PubSub.publish(DrawerEvents.DRAWER_SHOWN, root); PubSub.publish(DrawerEvents.DRAWER_SHOWN, root);

View File

@ -35,7 +35,7 @@
id="{{$drawerid}}drawer-{{uniqid}}{{/drawerid}}" id="{{$drawerid}}drawer-{{uniqid}}{{/drawerid}}"
class="{{$drawerclasses}}{{/drawerclasses}} drawer bg-white {{^show}}hidden{{/show}}" class="{{$drawerclasses}}{{/drawerclasses}} drawer bg-white {{^show}}hidden{{/show}}"
aria-expanded="{{#show}}true{{/show}}{{^show}}false{{/show}}" aria-expanded="{{#show}}true{{/show}}{{^show}}false{{/show}}"
aria-hidden="{{#show}}false{{/show}}{{^show}}true{{/show}}" {{^show}}aria-hidden="true"{{/show}}
data-region="right-hand-drawer" data-region="right-hand-drawer"
role="region" role="region"
tabindex="-1" tabindex="-1"