Skip to content

Commit

Permalink
V8: Accessibility improvements for page name entry (#5760)
Browse files Browse the repository at this point in the history
(cherry picked from commit ab3202b)
  • Loading branch information
RachBreeze authored and nul800sebastiaan committed Aug 9, 2019
1 parent a0cd542 commit 9cab789
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function () {
'use strict';

function EditorContentHeader(serverValidationManager) {
function EditorContentHeader(serverValidationManager, localizationService, editorState) {

function link(scope, el, attr, ctrl) {

Expand All @@ -13,7 +13,24 @@
if (!scope.serverValidationAliasField) {
scope.serverValidationAliasField = "Alias";
}


scope.isNew = scope.content.state == "NotCreated";

localizationService.localizeMany([
scope.isNew ? "placeholders_a11yCreateItem" : "placeholders_a11yEdit",
"placeholders_a11yName"]
).then(function (data) {
scope.a11yMessage = data[0];
scope.a11yName = data[1];
if (!scope.isNew) {
scope.a11yMessage += " " + scope.content.name;

} else {
var name = editorState.current.contentTypeName;
scope.a11yMessage += " " + name;
scope.a11yName = name + " " + scope.a11yName;
}
});
scope.vm = {};
scope.vm.dropdownOpen = false;
scope.vm.currentVariant = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,30 @@
<div class="flex items-center" style="flex: 1;">

<div id="nameField" class="umb-editor-header__name-and-description" style="flex: 1 1 auto;">
<div>
<p tabindex="0" class="sr-only">
{{a11yMessage}}
</p>
</div>
<div class="umb-editor-header__name-wrapper">
<label for="headerName" class="sr-only">{{a11yName}}</label>
<ng-form name="headerNameForm">
<input
data-element="editor-name-field"
type="text"
class="umb-editor-header__name-input"
localize="placeholder"
placeholder="@placeholders_entername"
name="headerName"
ng-model="name"
ng-class="{'name-is-empty': $parent.name===null || $parent.name===''}"
ng-disabled="nameDisabled"
umb-auto-focus
val-server-field="{{serverValidationNameField}}"
required
aria-required="true"
aria-invalid="{{contentForm.headerNameForm.headerName.$invalid ? true : false}}"
autocomplete="off" maxlength="255" />
<input data-element="editor-name-field"
type="text"
class="umb-editor-header__name-input"
localize="placeholder"
placeholder="@placeholders_entername"
name="headerName"
id="headerName"
ng-model="name"
ng-class="{'name-is-empty': $parent.name===null || $parent.name===''}"
ng-disabled="nameDisabled"
umb-auto-focus
val-server-field="{{serverValidationNameField}}"
required
aria-required="true"
aria-invalid="{{contentForm.headerNameForm.headerName.$invalid ? true : false}}"
autocomplete="off" maxlength="255" />
</ng-form>

<a ng-if="content.variants.length > 0 && hideChangeVariant !== true" class="umb-variant-switcher__toggle" href="" ng-click="vm.dropdownOpen = !vm.dropdownOpen" ng-class="{'--error': vm.errorsOnOtherVariants}">
Expand Down
3 changes: 3 additions & 0 deletions src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,9 @@
<key alias="anchor">#value or ?key=value</key>
<key alias="enterAlias">Enter alias...</key>
<key alias="generatingAlias">Generating alias...</key>
<key alias="a11yCreateItem">Create item</key>
<key alias="a11yEdit">Edit</key>
<key alias="a11yName">Name</key>
</area>
<area alias="editcontenttype">
<key alias="createListView" version="7.2">Create custom list view</key>
Expand Down
3 changes: 3 additions & 0 deletions src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@
<key alias="anchor">#value or ?key=value</key>
<key alias="enterAlias">Enter alias...</key>
<key alias="generatingAlias">Generating alias...</key>
<key alias="a11yCreateItem">Create item</key>
<key alias="a11yEdit">Edit</key>
<key alias="a11yName">Name</key>
</area>
<area alias="editcontenttype">
<key alias="createListView" version="7.2">Create custom list view</key>
Expand Down

0 comments on commit 9cab789

Please sign in to comment.