Merge pull request #4052 from google/no-auto-focusing

Removing auto-focusing in layout.
master
Sérgio Gomes 2016-02-01 11:50:50 +00:00
commit 286253ee0e
1 changed files with 1 additions and 6 deletions

View File

@ -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'] =