Skip to content

Commit

Permalink
fix(gcds-textarea): Properly set value in shadow-root textarea (#730)
Browse files Browse the repository at this point in the history
fix(gcds-textarea): Properly set value in shadowroot textarea
  • Loading branch information
ethanWallace authored Jan 10, 2025
1 parent a00e60d commit c3f18e6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/web/src/components/gcds-textarea/gcds-textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ export class GcdsTextarea {
*/
@Prop({ mutable: true }) value?: string;

/**
* Set value on internal textarea to allow proper resets
*/
@Watch('value')
watchValue(val) {
this.shadowElement.value = val;
}

/**
* Array of validators
*/
Expand Down Expand Up @@ -200,6 +208,7 @@ export class GcdsTextarea {
const val = e.target && e.target.value;
this.value = val;
this.internals.setFormValue(val ? val : null);
this.shadowElement.value = val;

if (e.type === 'change') {
const changeEvt = new e.constructor(e.type, e);
Expand Down

0 comments on commit c3f18e6

Please sign in to comment.