Removing auto-focusing in layout.

It looks jarring (particularly in mobile), and doesn't seem to be
mandated by the spec.
master
Sérgio Gomes 2016-02-01 11:23:03 +00:00
parent b7fd844a27
commit 8d66d37157
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'] =