Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V8: Login form accessibility improvements and form input tabbed focus styles #5304

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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