Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(textfield): add rows attribute #3332

Closed
wants to merge 5 commits into from

Conversation

ingorichter
Copy link
Contributor

@ingorichter ingorichter commented Jun 20, 2023

Description

Adding the rows attribute to enable a multiline Textarea to show up with a predefined amount of rows. We need this feature for an existing feature where we replace all react-spectrum components with spectrum-web-components.

Related issue(s)

Motivation and context

Product required for Adobe Share Dialog

How has this been tested?

  • Test case 1
    1. Go here
    2. Do this
  • Test case 2
    1. Go here
    2. Do this

Screenshots (if appropriate)

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

Does the use of rows negate any of the resize values?

@@ -244,6 +247,7 @@ export class TextfieldBase extends ManageHelpText(Focusable) {
?disabled=${this.disabled}
?required=${this.required}
?readonly=${this.readonly}
rows=${ifDefined(this.rows > -1 ? this.rows : undefined)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Using ifDefined here makes sense. Does it imply the type of rows should be rows?: number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, yes, it should be optional. Making it optional, the compiler will warn that this.rows might be undefined. IfDefined doesn't help with that situation. I followed some other properties like maxlength and minlength. They are optional, but not declared to be optional. Should I leave it as is? Or provide a getter for the property to check for undefined and > -1?

@ingorichter ingorichter marked this pull request as ready for review June 21, 2023 04:36
@ingorichter
Copy link
Contributor Author

@Westbrook using the rows attribute will definitely change the resize value to prevent any resizing of multiline textareas

@ingorichter
Copy link
Contributor Author

Closing this PR in favor of this PR #3356

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.

None yet

2 participants