From 81a3129ffb42a50536803f91cd99a4227f0f50ee Mon Sep 17 00:00:00 2001 From: Jeff Wong Date: Wed, 17 Jun 2020 05:55:19 -1000 Subject: [PATCH] ARIA - add aria-label on topic input and post textarea (#10057) Add reply form role with label as create/reply, and aria-labels on text inputs --- .../javascripts/discourse/app/components/d-textarea.js | 5 +++++ .../javascripts/discourse/app/components/text-field.js | 3 ++- .../discourse/app/templates/components/composer-title.hbs | 1 + .../discourse/app/templates/components/d-editor.hbs | 3 ++- app/assets/javascripts/discourse/app/templates/composer.hbs | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/discourse/app/components/d-textarea.js diff --git a/app/assets/javascripts/discourse/app/components/d-textarea.js b/app/assets/javascripts/discourse/app/components/d-textarea.js new file mode 100644 index 00000000000..a3979bd2ce9 --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/d-textarea.js @@ -0,0 +1,5 @@ +import TextArea from "@ember/component/text-area"; + +export default TextArea.extend({ + attributeBindings: ["aria-label"] +}); diff --git a/app/assets/javascripts/discourse/app/components/text-field.js b/app/assets/javascripts/discourse/app/components/text-field.js index f9c13ec4d37..c61d0e70234 100644 --- a/app/assets/javascripts/discourse/app/components/text-field.js +++ b/app/assets/javascripts/discourse/app/components/text-field.js @@ -12,7 +12,8 @@ export default TextField.extend({ "autocapitalize", "autofocus", "maxLength", - "dir" + "dir", + "aria-label" ], init() { diff --git a/app/assets/javascripts/discourse/app/templates/components/composer-title.hbs b/app/assets/javascripts/discourse/app/templates/components/composer-title.hbs index a8483595de6..c29ed22187d 100644 --- a/app/assets/javascripts/discourse/app/templates/components/composer-title.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/composer-title.hbs @@ -3,6 +3,7 @@ id="reply-title" maxLength=titleMaxLength placeholderKey=composer.titlePlaceholder + aria-label=(I18n composer.titlePlaceholder) disabled=disabled autocomplete="discourse"}} diff --git a/app/assets/javascripts/discourse/app/templates/components/d-editor.hbs b/app/assets/javascripts/discourse/app/templates/components/d-editor.hbs index 0c7cdebdedf..5528aeb6698 100644 --- a/app/assets/javascripts/discourse/app/templates/components/d-editor.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/d-editor.hbs @@ -33,12 +33,13 @@ {{conditional-loading-spinner condition=loading}} - {{textarea + {{d-textarea autocomplete="discourse" tabindex=tabindex value=value class="d-editor-input" placeholder=placeholderTranslated + aria-label=placeholderTranslated disabled=disabled input=change}} {{popup-input-tip validation=validation}} diff --git a/app/assets/javascripts/discourse/app/templates/composer.hbs b/app/assets/javascripts/discourse/app/templates/composer.hbs index b3a075b6840..e8dbfc8fff8 100644 --- a/app/assets/javascripts/discourse/app/templates/composer.hbs +++ b/app/assets/javascripts/discourse/app/templates/composer.hbs @@ -10,7 +10,7 @@ messageCount=messageCount addLinkLookup=(action "addLinkLookup")}} {{#if model.viewOpenOrFullscreen}} -
+
{{plugin-outlet name="composer-open" args=(hash model=model)}}