commit
286253ee0e
|
@ -250,21 +250,16 @@
|
|||
*/
|
||||
MaterialLayout.prototype.toggleDrawer = function() {
|
||||
var drawerButton = this.element_.querySelector('.' + this.CssClasses_.DRAWER_BTN);
|
||||
var firstLink = document.querySelector('.' + this.CssClasses_.DRAWER + ' a');
|
||||
this.drawer_.classList.toggle(this.CssClasses_.IS_DRAWER_OPEN);
|
||||
this.obfuscator_.classList.toggle(this.CssClasses_.IS_DRAWER_OPEN);
|
||||
|
||||
// focus first link if drawer will be opened otherwise focus the drawer button
|
||||
// Set accessibility properties.
|
||||
if (this.drawer_.classList.contains(this.CssClasses_.IS_DRAWER_OPEN)) {
|
||||
this.drawer_.setAttribute('aria-hidden', 'false');
|
||||
drawerButton.setAttribute('aria-expanded', 'true');
|
||||
if (firstLink) {
|
||||
firstLink.focus();
|
||||
}
|
||||
} else {
|
||||
this.drawer_.setAttribute('aria-hidden', 'true');
|
||||
drawerButton.setAttribute('aria-expanded', 'false');
|
||||
drawerButton.focus();
|
||||
}
|
||||
};
|
||||
MaterialLayout.prototype['toggleDrawer'] =
|
||||
|
|
Loading…
Reference in New Issue