Skip to content

Conversation

@varun-srinivasa
Copy link
Contributor

💡 What is the current behavior?

textareaRows property has no noticable effect on the component.
textareaWidth property relative values (e.g. 50%) will not work as expected

GitHub Issue Number: #1975 only textarea

🆕 What is the new behavior?

  • Textarea Rows and textarea width has effect

🏁 Checklist

A pull request can only be merged if all of these conditions are met (where applicable):

  • 🦮 Accessibility (a11y) features were implemented
  • 🗺️ Internationalization (i18n) - no hard coded strings
  • 📲 Responsiveness - components handle viewport changes and content overflow gracefully
  • 📕 Add or update a Storybook story
  • 📄 Documentation was reviewed/updated siemens/ix-docs
  • 🧪 Unit tests were added/updated and pass (pnpm test)
  • 📸 Visual regression tests were added/updated and pass (Guide)
  • 🧐 Static code analysis passes (pnpm lint)
  • 🏗️ Successful compilation (pnpm build, changes pushed)

👨‍💻 Help & support

@changeset-bot
Copy link

changeset-bot bot commented Jul 29, 2025

🦋 Changeset detected

Latest commit: 843103f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@siemens/ix Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@varun-srinivasa varun-srinivasa marked this pull request as ready for review August 11, 2025 04:09
Copy link
Collaborator

@danielleroux danielleroux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing component test which verify all cases. Please add

@sonarqubecloud
Copy link

@nuke-ellington
Copy link
Collaborator

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to fix issues with the textarea-rows and textarea-width properties. The approach of removing the fixed height from the textarea mixin and using CSS custom properties for the width is sound. The added regression tests are also a great addition to verify the fixes.

I've found a couple of issues with the implementation. The logic for textareaWidth does not account for dynamic updates to the property after the component has loaded. Additionally, there's a conflicting inline style being applied that will prevent the new width logic from working as intended. I've also pointed out a minor code style inconsistency in the SCSS changes. My review comments provide more details and suggestions for how to address these points.

Comment on lines 177 to 183
if (this.textareaWidth) {
this.hostElement.style.setProperty(
'--textarea-width',
this.textareaWidth
);
this.hostElement.setAttribute('textarea-width', '');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There are a couple of issues with the implementation for textareaWidth:

  1. Dynamic updates are not handled: This logic only runs when the component loads. If the textareaWidth prop is changed dynamically after the component has been mounted, the width will not update. To fix this, you should handle property changes using a @Watch('textareaWidth') decorator. I suggest extracting this logic into a private method and calling it from both componentWillLoad and the new watcher method.

    Example:

    @Watch('textareaWidth')
    onTextareaWidthChange() {
      this.setTextareaWidth();
    }
    
    // In componentWillLoad, replace the current logic with:
    this.setTextareaWidth();
    
    private setTextareaWidth() {
      if (this.textareaWidth) {
        this.hostElement.style.setProperty('--textarea-width', this.textareaWidth);
        this.hostElement.setAttribute('textarea-width', '');
      } else {
        this.hostElement.style.removeProperty('--textarea-width');
        this.hostElement.removeAttribute('textarea-width');
      }
    }
  2. Conflicting width styles: The textareaWidth prop is still passed to TextareaElement and applied as an inline width style on the <textarea> element in packages/core/src/components/input/input.fc.tsx. This will override the width: 100% from the stylesheet and cause incorrect layout. You should remove the width: props.textareaWidth from the style object in TextareaElement to allow the textarea to correctly fill its container.

Copy link
Collaborator

@nuke-ellington nuke-ellington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Rows and width act like max-width/-height which they shouldn't. User should still be able to drag the textarea to be larger like the native HTML textarea handles it
  • Please resolve Gemini review
  • Please resolve Sonar issues

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants