appuniversum / ember-appuniversum

Ember addon wrapping the appuniversum components.
https://appuniversum.github.io/ember-appuniversum
MIT License
14 stars 11 forks source link

Deprecate the 2-way-binding in the AuTexarea component #436

Closed Windvis closed 12 months ago

Windvis commented 12 months ago

It seems we're still using Textarea internally. We should give this the same treatment as AuInput.

Windvis commented 12 months ago

Unlike the <input> element, the <textarea> doesn't support a value attribute. <textarea value="something"></textarea> would show an empty textarea in regular html files.

However, in Ember that does work since the Glimmer VM sets the property instead of the attribute.

In theory we could support these 2 variants:

  1. <AuTextarea {{on "change" this.handleChange}}>{{this.value}}</AuTextarea>
  2. <AuTextarea value={{this.value}} {{on "change" this.handleChange}} />

1 follows the regular html behavior, 2 follows the recommended path for the AuInput component.

Supporting case 1 implicitly supports case 2 since we need ...attributes in both cases and you can simply ignore the block. I would prefer to document a single variant though.

The gotcha with case 1 is that it is white space sensitive. <AuTextarea> something </AuTextarea> will result in a value of " something ".