Skip to content

Commit

Permalink
Merge pull request #5304 from MMasey/v8/feature/tab-accessibility-imp…
Browse files Browse the repository at this point in the history
…rovements

V8: Login form accessibility improvements and form input tabbed focus styles
  • Loading branch information
Warren Buckley authored Apr 24, 2019
2 parents c21b740 + 233f00e commit 9333426
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
function togglePassword() {
var elem = $("form[name='vm.loginForm'] input[name='password']");
elem.attr("type", (elem.attr("type") === "text" ? "password" : "text"));
elem.focus();
$(".password-text.show, .password-text.hide").toggle();
}

Expand Down
13 changes: 13 additions & 0 deletions src/Umbraco.Web.UI.Client/src/controllers/main.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,20 @@ function MainController($scope, $location, appState, treeService, notificationsS
$scope.drawer = {};
$scope.search = {};
$scope.login = {};
$scope.tabbingActive = false;

// There are a number of ways to detect when a focus state should be shown when using the tab key and this seems to be the simplest solution.
// For more information about this approach, see https://hackernoon.com/removing-that-ugly-focus-ring-and-keeping-it-too-6c8727fefcd2
function handleFirstTab(evt) {
if (evt.keyCode === 9) {
$scope.tabbingActive = true;
window.removeEventListener('keydown', handleFirstTab);
}
}

window.addEventListener("keydown", handleFirstTab);


$scope.removeNotification = function (index) {
notificationsService.remove(index);
};
Expand Down
5 changes: 4 additions & 1 deletion src/Umbraco.Web.UI.Client/src/less/forms.less
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ input[type="color"],
&:focus {
border-color: @inputBorderFocus;
outline: 0;
outline: none \9; /* IE6-9 */

.tabbing-active & {
outline: 2px solid @inputBorderTabFocus;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/Umbraco.Web.UI.Client/src/less/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@
@inputBackground: @white;
@inputBorder: @gray-8;
@inputBorderFocus: @gray-7;
@inputBorderTabFocus: @blueExtraDark;
@inputBorderRadius: 0;
@inputDisabledBackground: @gray-10;
@formActionsBackground: @gray-9;
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI/Umbraco/Views/Default.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@Html.RenderCssHere(
new BasicPath("Umbraco", IOHelper.ResolveUrl(SystemDirectories.Umbraco)))
</head>
<body ng-class="{'touch':touchDevice, 'emptySection':emptySection, 'umb-drawer-is-visible':drawer.show, 'umb-tour-is-visible': tour.show}" ng-controller="Umbraco.MainController" id="umbracoMainPageBody">
<body ng-class="{'touch':touchDevice, 'emptySection':emptySection, 'umb-drawer-is-visible':drawer.show, 'umb-tour-is-visible': tour.show, 'tabbing-active':tabbingActive}" ng-controller="Umbraco.MainController" id="umbracoMainPageBody">

<noscript>
<div style="margin: 10px;">
Expand Down

0 comments on commit 9333426

Please sign in to comment.