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: Accessibility Changes For umbEditorHeader Directive #6315

Merged
merged 32 commits into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
19aa728
Umb editor control contains a11y support for the media section
Sep 4, 2019
8d4f983
Started work to align to the settings section
Sep 8, 2019
1bb5139
A11Y Amends for umbraco header directive specifically to support docu…
Sep 9, 2019
a52d36a
Merge branch 'master' of https://github.com/RachBreeze/Umbraco-CMS in…
Oct 2, 2019
8dbbd8c
Fixed error when creating a new user
Oct 2, 2019
9066776
This change makes sure that if a relationship type is edited, followe…
Oct 2, 2019
ed9ec07
Umbraco Header directive now uses "create" rather than create item
Oct 2, 2019
9c1effe
Made the ediorFor property more generic
Oct 2, 2019
e312610
Made the ediorFor property more generic
Oct 2, 2019
5c61fd7
Edit and create template now aligns to the more a11y header directive
Oct 2, 2019
88bfce3
Added support for a11y name and title on settings->scripts
Oct 2, 2019
faae644
Added support for a11y name and title on settings->stylesheets
Oct 2, 2019
d24933d
Added support for a11y name and title on settings->partial views
Oct 3, 2019
b0beccc
Added support for a11y name and title on settings->partial view macros
Oct 3, 2019
063900f
Merge branch 'v8/dev' of https://github.com/RachBreeze/Umbraco-CMS in…
Oct 6, 2019
fc741df
Added support for a11y name and title when editing members
Oct 6, 2019
d821265
Added support for a11y name and title when editing member groups
Oct 6, 2019
67cb609
Updated to ignore package-lock
Oct 6, 2019
0fa2d24
Added support for a11y name and title when editing media types
Oct 6, 2019
d9d7878
Added the ability to prevent the title being set via the umbeditorhea…
Oct 6, 2019
39faa87
No longer sets the page title by default
Oct 6, 2019
1e35b14
No longer sets the page title by default
Oct 6, 2019
850fad2
Added support for a11y name and title when editing members
Oct 6, 2019
2903327
Added support for a11y name and title when editing dictionary items
Oct 7, 2019
be204ad
Removed bug where by screen reader was reading "blank" when the name-…
Oct 7, 2019
dbe71b7
Merge branch 'v8/dev' of https://github.com/RachBreeze/Umbraco-CMS in…
Oct 21, 2019
1cb55a0
Fixing redering issues following refactor
Oct 27, 2019
a59f402
Don't ignore package-lock.json
emmaburstow Oct 28, 2019
f971cb4
Merged languages
Oct 29, 2019
0f48100
Merge branch 'v8/dev' into v8/a11y_umbeditor_directive
emmaburstow Oct 29, 2019
29ce126
Merge branch 'v8/dev' into pr/6315
emmaburstow Oct 30, 2019
29bb8e6
Fix up merge errors
nul800sebastiaan Oct 30, 2019
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 @@ -195,22 +195,55 @@ Use this directive to construct a header inside the main editor window.
@param {string=} icon Show and edit the content icon. Opens an overlay to change the icon.
@param {boolean=} hideIcon Set to <code>true</code> to hide icon.
@param {string=} alias show and edit the content alias.
@param {boolean=} aliasLocked Set to <code>true</code> to lock the alias.
@param {boolean=} hideAlias Set to <code>true</code> to hide alias.
@param {string=} description Add a description to the content.
@param {boolean=} hideDescription Set to <code>true</code> to hide description.

@param {boolean=} setpagetitle If true the page title will be set to reflect the type of data the header is working with
@param {string=} editorfor The localization to use to aid accessibility on the edit and create screen
**/

(function () {
'use strict';

function EditorHeaderDirective(editorService) {
function EditorHeaderDirective(editorService, localizationService, editorState) {

function link(scope, $injector) {

function link(scope) {
scope.vm = {};
scope.vm.dropdownOpen = false;
scope.vm.currentVariant = "";
scope.loading = true;
scope.accessibility = {};
scope.accessibility.a11yMessage = "";
scope.accessibility.a11yName = "";
scope.accessibility.a11yMessageVisible = false;
scope.accessibility.a11yNameVisible = false;

// need to call localizationService service outside of routine to set a11y due to promise requirements
if (editorState.current) {
//to do make work for user create/edit
// to do make it work for user group create/ edit
// to make it work for language edit/create
scope.isNew = editorState.current.id === 0 ||
editorState.current.id === "0" ||
editorState.current.id === -1 ||
editorState.current.id === 0 ||
editorState.current.id === "-1";

var localizeVars = [
scope.isNew ? "placeholders_a11yCreateItem" : "placeholders_a11yEdit",
"placeholders_a11yName",
scope.isNew ? "general_new" : "general_edit"
];

if (scope.editorfor) {
localizeVars.push(scope.editorfor);
}
localizationService.localizeMany(localizeVars).then(function (data) {
setAccessibilityForEditor(data);
scope.loading = false;
});
}

scope.goBack = function () {
if (scope.onBack) {
Expand Down Expand Up @@ -247,6 +280,57 @@ Use this directive to construct a header inside the main editor window.
editorService.iconPicker(iconPicker);
};

function setAccessibilityForEditor(data) {

if (editorState.current) {
if (scope.nameLocked) {
scope.accessibility.a11yName = scope.name;
SetPageTitle(scope.name);
} else {

scope.accessibility.a11yMessage = data[0];
scope.accessibility.a11yName = data[1];
var title = data[2] + ":";
if (!scope.isNew) {
scope.accessibility.a11yMessage += " " + scope.name;
title += " " + scope.name;
} else {
var name = "";
if (editorState.current.contentTypeName) {
name = editorState.current.contentTypeName;
} else if (scope.editorfor) {
name = data[3];
}
if (name !== "") {
scope.accessibility.a11yMessage += " " + name;
scope.accessibility.a11yName = name + " " + scope.accessibility.a11yName;
title += " " + name;
}
}
if (title !== data[2] + ":") {
SetPageTitle(title);
}

}
scope.accessibility.a11yMessageVisible = !isEmptyOrSpaces(scope.accessibility.a11yMessage);
scope.accessibility.a11yNameVisible = !isEmptyOrSpaces(scope.accessibility.a11yName);
}

}

function isEmptyOrSpaces(str) {
return str === null || str===undefined || str.trim ==='';
}

function SetPageTitle(title) {
var setTitle = false;
if (scope.setpagetitle !== undefined) {
setTitle = scope.setpagetitle;
}
if (setTitle) {
scope.$emit("$changeTitle", title);
}
}
}

var directive = {
Expand All @@ -262,7 +346,6 @@ Use this directive to construct a header inside the main editor window.
icon: "=",
hideIcon: "@",
alias: "=",
aliasLocked: "<",
hideAlias: "=",
description: "=",
hideDescription: "@",
Expand All @@ -271,7 +354,9 @@ Use this directive to construct a header inside the main editor window.
onSelectNavigationItem: "&?",
key: "=",
onBack: "&?",
showBackButton: "<?"
showBackButton: "<?",
editorfor: "=",
setpagetitle:"="
},
link: link
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div data-element="editor-header" class="umb-editor-header" ng-class="{'-split-view-active': splitViewOpen === true}">

<div class="flex items-center" style="height: 100%;">
<umb-loader ng-show="loading"></umb-loader>
<div class="flex items-center" style="height: 100%;" ng-hide="loading">

<div ng-if="showBackButton === true && splitViewOpen !== true" style="margin-right: 15px;">
<button type="button" class="umb-editor-header__back" ng-click="goBack()" prevent-default>
Expand All @@ -22,11 +22,18 @@
</ng-form>

<div id="nameField" class="umb-editor-header__name-and-description" style="flex: 1 1 auto;">
<div>
<p tabindex="0" class="sr-only" ng-show="accessibility.a11yMessageVisible">
{{accessibility.a11yMessage}}
</p>
</div>
<div class="umb-editor-header__name-wrapper" ng-show="!nameLocked || !hideAlias">
<label for="headerName" class="sr-only" ng-show="accessibility.a11yNameVisible">{{accessibility.a11yName}}</label>
<ng-form name="headerNameForm">
<input data-element="editor-name-field"
no-password-manager
type="text"
id="headerName"
class="umb-editor-header__name-input"
localize="placeholder"
placeholder="@placeholders_entername"
Expand All @@ -38,7 +45,10 @@
focus-on-filled="true"
val-server-field="Name"
required
autocomplete="off" />
aria-required="true"
aria-invalid="{{contentForm.headerNameForm.headerName.$invalid ? true : false}}"
autocomplete="off"
maxlength="255"/>
</ng-form>

<umb-generate-alias data-element="editor-alias"
Expand All @@ -62,7 +72,7 @@
localize="placeholder"
placeholder="@placeholders_enterDescription"
ng-if="!hideDescription && !descriptionLocked"
ng-model="$parent.description" />
ng-model="$parent.description"/>

<div class="umb-panel-header-locked-description" ng-if="descriptionLocked">{{ description }}</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ function DictionaryEditController($scope, $routeParams, $location, dictionaryRes

//setup scope vars
vm.nameDirty = false;
vm.header = {};
vm.header.editorfor = "template_insertDictionaryItem";
vm.header.setPageTitle = true;

vm.page = {};
vm.page.loading = false;
vm.page.nameLocked = false;
Expand Down
4 changes: 3 additions & 1 deletion src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
hide-description="true"
hide-alias="true"
on-back="vm.back()"
show-back-button="vm.showBackButton">
show-back-button="vm.showBackButton"
editorfor="vm.header.editorfor"
setpagetitle="vm.header.setPageTitle">
</umb-editor-header>

<umb-editor-container class="form-horizontal">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

vm.currentNode = null;
vm.contentType = {};
vm.header = {};
vm.header.editorfor = "content_documentType";
vm.header.setPageTitle = true;
vm.labels = {};
vm.submitButtonKey = "buttons_save";
vm.generateModelsKey = "buttons_saveAndGenerateModels";
Expand All @@ -33,7 +36,7 @@
vm.page.loading = false;
vm.page.saveButtonState = "init";
vm.page.navigation = [];

var labelKeys = [
"general_design",
"general_listView",
Expand Down
4 changes: 3 additions & 1 deletion src/Umbraco.Web.UI.Client/src/views/documenttypes/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
key="vm.contentType.key"
description="vm.contentType.description"
navigation="vm.page.navigation"
icon="vm.contentType.icon">
icon="vm.contentType.icon"
editorfor="vm.header.editorfor"
setpagetitle="vm.header.setPageTitle">
</umb-editor-header>

<umb-editor-container class="editors-document-type-container">
Expand Down
3 changes: 2 additions & 1 deletion src/Umbraco.Web.UI.Client/src/views/media/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
navigation="content.apps"
on-select-navigation-item="appChanged(item)"
show-back-button="showBack()"
on-back="onBack()">
on-back="onBack()"
setpagetitle="header.setPageTitle">
</umb-editor-header>

<umb-editor-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function mediaEditController($scope, $routeParams, $q, appState, mediaResource,
//setup scope vars
$scope.currentSection = appState.getSectionState("currentSection");
$scope.currentNode = null; //the editors affiliated node

$scope.header = {};
$scope.header.setPageTitle = $scope.currentSection ==="media";
$scope.page = {};
$scope.page.loading = false;
$scope.page.menu = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
vm.close = close;

vm.currentNode = null;
vm.header = {};
vm.header.editorfor = "content_mediatype";
vm.header.setPageTitle = true;
vm.contentType = {};
vm.page = {};
vm.page.loading = false;
Expand Down
4 changes: 3 additions & 1 deletion src/Umbraco.Web.UI.Client/src/views/mediatypes/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
key="vm.contentType.key"
description="vm.contentType.description"
navigation="vm.page.navigation"
icon="vm.contentType.icon">
icon="vm.contentType.icon"
editorfor="vm.header.editorfor"
setpagetitle="vm.header.setPageTitle">
</umb-editor-header>

<umb-editor-container class="editors-document-type-container">
Expand Down
4 changes: 3 additions & 1 deletion src/Umbraco.Web.UI.Client/src/views/member/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
hide-description="true"
hide-alias="true"
show-back-button="showBack()"
on-back="onBack()">
on-back="onBack()"
editorfor="header.editorfor"
setpagetitle="header.setPageTitle">
</umb-editor-header>

<umb-editor-container class="form-horizontal">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ function MemberEditController($scope, $routeParams, $location, appState, memberR
var listName = infiniteMode ? $scope.model.listname : $routeParams.listName;
var docType = infiniteMode ? $scope.model.doctype : $routeParams.doctype;

$scope.header = {};
$scope.header.editorfor = "visuallyHiddenTexts_newMember";
$scope.header.setPageTitle = true;

//setup scope vars
$scope.page = {};
$scope.page.loading = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ function MemberGroupsEditController($scope, $routeParams, appState, navigationSe
//setup scope vars
$scope.page = {};
$scope.page.loading = false;
$scope.header = {};
$scope.header.editorfor = "content_membergroup";
$scope.header.setPageTitle = true;
$scope.page.menu = {};
$scope.page.menu.currentSection = appState.getSectionState("currentSection");
$scope.page.menu.currentNode = null;
Expand Down
4 changes: 3 additions & 1 deletion src/Umbraco.Web.UI.Client/src/views/membergroups/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
name-locked="page.nameLocked"
hide-icon="true"
hide-description="true"
hide-alias="true">
hide-alias="true"
editorfor="header.editorfor"
setpagetitle="header.setPageTitle">
</umb-editor-header>

<umb-editor-container class="form-horizontal">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
var vm = this;

vm.save = save;

vm.editorfor = "visuallyHiddenTexts_newMember";
vm.header = {};
vm.header.editorfor = "content_membergroup";
vm.header.setPageTitle = true;
vm.currentNode = null;
vm.contentType = {};
vm.page = {};
Expand Down
4 changes: 3 additions & 1 deletion src/Umbraco.Web.UI.Client/src/views/membertypes/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
alias="vm.contentType.alias"
description="vm.contentType.description"
navigation="vm.page.navigation"
icon="vm.contentType.icon">
icon="vm.contentType.icon"
editorfor="vm.header.editorfor"
setpagetitle="vm.header.setPageTitle">
</umb-editor-header>

<umb-editor-container class="editors-document-type-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

var vm = this;

vm.header = {};
vm.header.editorfor = "visuallyHiddenTexts_newPartialViewMacro";
vm.header.setPageTitle = true;
vm.page = {};
vm.page.loading = true;
vm.partialViewMacroFile = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
hide-alias="true"
description="vm.partialViewMacro.virtualPath"
description-locked="true"
hide-icon="true">
hide-icon="true"
editorfor="vm.header.editorfor"
setpagetitle="vm.header.setPageTitle">
</umb-editor-header>

<umb-editor-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

vm.close = close;

vm.header = {};
vm.header.editorfor = "visuallyHiddenTexts_newPartialView";
vm.header.setPageTitle = true;

vm.page = {};
vm.page.loading = true;
vm.partialView = {};
Expand Down
4 changes: 3 additions & 1 deletion src/Umbraco.Web.UI.Client/src/views/partialviews/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
hide-alias="true"
description="vm.partialView.virtualPath"
description-locked="true"
hide-icon="true">
hide-icon="true"
editorfor="vm.header.editorfor"
setpagetitle="vm.header.setPageTitle">
</umb-editor-header>

<umb-editor-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function RelationTypeCreateController($scope, $location, relationTypeResource, n
init();

function init() {
$scope.$emit("$changeTitle", "");
relationTypeResource.getRelationObjectTypes().then(function(data) {
vm.objectTypes = data;
},
Expand Down
Loading