Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(): Focus management for docs views
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcy Sutton authored and ajoslin committed Oct 16, 2014
1 parent a355942 commit 9afe28a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 14 additions & 7 deletions docs/app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ function(COMPONENTS, DEMOS, $location, $rootScope) {
url: componentDemos.url
});
});
console.log(apiDocs);
console.log(demoDocs);

sections.unshift({
name: 'Demos',
Expand Down Expand Up @@ -180,18 +178,22 @@ function(COMPONENTS, DEMOS, $location, $rootScope) {
'$mdDialog',
'menu',
'$location',
function($scope, COMPONENTS, $mdSidenav, $timeout, $mdDialog, menu, $location ) {
'$rootScope',
function($scope, COMPONENTS, $mdSidenav, $timeout, $mdDialog, menu, $location, $rootScope ) {

$scope.COMPONENTS = COMPONENTS;

$scope.menu = menu;

var mainContentArea = document.querySelector("[role='main']");

$scope.toggleMenu = function() {
$timeout(function() {
$mdSidenav('left').toggle();
});
$rootScope.$on('$locationChangeSuccess', openPage);

$scope.closeMenu = function() {
$timeout(function() { $mdSidenav('left').close(); });
};
$scope.openMenu = function() {
$timeout(function() { $mdSidenav('left').open(); });
};

$scope.path = function() {
Expand All @@ -202,6 +204,11 @@ function($scope, COMPONENTS, $mdSidenav, $timeout, $mdDialog, menu, $location )
menu.selectPage(null, null);
$location.path( '/' );
};

function openPage() {
$scope.closeMenu();
mainContentArea.focus();
}
}])

.controller('HomeCtrl', [
Expand Down
4 changes: 2 additions & 2 deletions docs/config/template/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<md-toolbar class="md-theme-light md-medium-tall">
<h1 class="md-toolbar-tools" style="padding-top:25px;">
<a href="#" ng-click="goHome()">Angular<br/>Material Design</a>
<a href="#/" ng-click="goHome()">Angular<br/>Material Design</a>
</h1>
</md-toolbar>

Expand Down Expand Up @@ -49,7 +49,7 @@ <h1 class="md-toolbar-tools" style="padding-top:25px;">
<div layout="vertical" layout-fill tabIndex="-1" role="main">
<md-toolbar class="md-theme-dark md-medium-tall app-toolbar">

<div class="md-toolbar-tools" ng-click="toggleMenu()">
<div class="md-toolbar-tools" ng-click="openMenu()">
<button class="menu-icon" hide-md aria-label="Toggle Menu">
<md-icon icon="img/icons/ic_menu_24px.svg">
</md-icon>
Expand Down

0 comments on commit 9afe28a

Please sign in to comment.