From 1161c980f2ff39b876c8e34d40cd4fcc9eeed628 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 17 Mar 2023 11:55:29 +0000 Subject: [PATCH] DEV: Resolve and unsilence `ember.built-in-components` deprecation (#20716) - Install `@ember/legacy-built-in-components` and update our import statements to use it - Remove our custom attributeBinding extensions of `TextField` and `TextArea`. Modern ember 'angle bracket syntax' allows us to apply html attributes to a component's element without needing attributeBindings --- .../discourse/app/components/d-textarea.js | 2 +- .../app/components/expanding-text-area.js | 2 +- .../discourse/app/components/text-field.js | 2 +- .../ember-input-component-extension.js | 22 ---------------- .../app/templates/modal/create-account.hbs | 8 +++--- .../discourse/config/deprecation-workflow.js | 2 -- app/assets/javascripts/discourse/package.json | 1 + app/assets/javascripts/yarn.lock | 26 +++++++++++++++++++ 8 files changed, 34 insertions(+), 31 deletions(-) delete mode 100644 app/assets/javascripts/discourse/app/initializers/ember-input-component-extension.js diff --git a/app/assets/javascripts/discourse/app/components/d-textarea.js b/app/assets/javascripts/discourse/app/components/d-textarea.js index 2c231631cf9..a4f296e2dfb 100644 --- a/app/assets/javascripts/discourse/app/components/d-textarea.js +++ b/app/assets/javascripts/discourse/app/components/d-textarea.js @@ -1,4 +1,4 @@ -import TextArea from "@ember/component/text-area"; +import { TextArea } from "@ember/legacy-built-in-components"; export default TextArea.extend({ attributeBindings: ["aria-label"], diff --git a/app/assets/javascripts/discourse/app/components/expanding-text-area.js b/app/assets/javascripts/discourse/app/components/expanding-text-area.js index 86a15b910b8..58b3dff7961 100644 --- a/app/assets/javascripts/discourse/app/components/expanding-text-area.js +++ b/app/assets/javascripts/discourse/app/components/expanding-text-area.js @@ -1,5 +1,5 @@ import { observes, on } from "discourse-common/utils/decorators"; -import TextArea from "@ember/component/text-area"; +import { TextArea } from "@ember/legacy-built-in-components"; import autosize from "discourse/lib/autosize"; import { schedule } from "@ember/runloop"; diff --git a/app/assets/javascripts/discourse/app/components/text-field.js b/app/assets/javascripts/discourse/app/components/text-field.js index 9044d9c1ced..8f82fffff4a 100644 --- a/app/assets/javascripts/discourse/app/components/text-field.js +++ b/app/assets/javascripts/discourse/app/components/text-field.js @@ -1,7 +1,7 @@ import { cancel, next } from "@ember/runloop"; import { isLTR, isRTL, siteDir } from "discourse/lib/text-direction"; import I18n from "I18n"; -import TextField from "@ember/component/text-field"; +import { TextField } from "@ember/legacy-built-in-components"; import discourseComputed from "discourse-common/utils/decorators"; import discourseDebounce from "discourse-common/lib/debounce"; diff --git a/app/assets/javascripts/discourse/app/initializers/ember-input-component-extension.js b/app/assets/javascripts/discourse/app/initializers/ember-input-component-extension.js deleted file mode 100644 index 841ff0e9929..00000000000 --- a/app/assets/javascripts/discourse/app/initializers/ember-input-component-extension.js +++ /dev/null @@ -1,22 +0,0 @@ -import TextField from "@ember/component/text-field"; -import TextArea from "@ember/component/text-area"; -let initializedOnce = false; - -export default { - name: "ember-input-component-extensions", - - initialize() { - if (initializedOnce) { - return; - } - - TextField.reopen({ - attributeBindings: ["aria-describedby", "aria-invalid"], - }); - TextArea.reopen({ - attributeBindings: ["aria-describedby", "aria-invalid"], - }); - - initializedOnce = true; - }, -}; diff --git a/app/assets/javascripts/discourse/app/templates/modal/create-account.hbs b/app/assets/javascripts/discourse/app/templates/modal/create-account.hbs index 2be3ffb3b69..8a560fe8777 100644 --- a/app/assets/javascripts/discourse/app/templates/modal/create-account.hbs +++ b/app/assets/javascripts/discourse/app/templates/modal/create-account.hbs @@ -94,8 +94,8 @@ @value={{this.accountName}} @id="new-account-name" @class={{value-entered this.accountName}} - @aria-describedby="fullname-validation" - @aria-invalid={{this.nameValidation.failed}} + aria-describedby="fullname-validation" + aria-invalid={{this.nameValidation.failed}} />