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

Text Area Max Length #706

Merged
merged 3 commits into from
Dec 2, 2020
Merged

Text Area Max Length #706

merged 3 commits into from
Dec 2, 2020

Conversation

StevenUlmer
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added
  • Docs have been added or updated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Style Update (CSS)
  • Other... Please describe:

What is the current behavior?

Resolves #705

What is the new behavior?

There is the ability to pass in a maxlength on the text area

Does this PR introduce a breaking change?

  • Yes
  • No

@StevenUlmer StevenUlmer added feature New feature request hacktoberfest-accepted Accepted PR for Hacktoberfest labels Oct 30, 2020
@StevenUlmer StevenUlmer requested a review from jaredami October 30, 2020 18:40
Copy link
Contributor

@jaredami jaredami left a comment

Choose a reason for hiding this comment

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

Just noticed a typo but looks good otherwise 👍

@grahamhency
Copy link
Contributor

@StevenUlmer, what if we also add on the minlength attribute to this? Probably not going to be used very often, but we're doing it in this PR as well #699

@StevenUlmer StevenUlmer requested a review from jaredami November 9, 2020 17:19
grahamhency
grahamhency previously approved these changes Nov 9, 2020
Copy link
Contributor

@grahamhency grahamhency left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

Copy link
Contributor

@jaredami jaredami left a comment

Choose a reason for hiding this comment

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

Couple of things in addition to my question about attribute vs property binding:

  1. Should we add default values and add some logic to ensure that the minlength can't be set to greater than the maxlength, like what was done here?
  2. Should we technically use brackets when setting the binding values since the inputs are of type number rather than string? Maybe not worth caring about...

Comment on lines 18 to 19
[attr.maxlength]="maxlength || null"
[attr.minlength]="minlength || null"
Copy link
Contributor

Choose a reason for hiding this comment

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

One question I have about this is whether we should be using attr. for these. In the Angular docs it says: "It is recommended that you set an element property with a property binding whenever possible."

Also here it says "Attributes initialize DOM properties and then they are done. Property values can change; attribute values can't." I'm wondering if that means that when you use attr. it makes the binding static (i.e. it won't update if the value is changed)?

These two things make me think maybe we should just property binding here, unless the text-areas don't have these properties.

@grahamhency grahamhency merged commit b12a426 into dev Dec 2, 2020
@grahamhency grahamhency deleted the text_area_maxlength branch December 2, 2020 19:21
@grahamhency grahamhency mentioned this pull request Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request hacktoberfest-accepted Accepted PR for Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Max Length for Text Area
3 participants