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

Replace character counter "data-length" attribute #381

Merged

Conversation

mauromascarenhas
Copy link

Proposed changes

As discussed in RFC#380, this PR aims to replace the "data-length" attribute of "CharacterCounter" by the standard "maxlength" attr.

Highlights:

  • CharacterCounter must use "maxlength" attribute to build a limited counter ("data-length") has been deprecated;
  • Added test suites to CharacterCounter component;
  • Updated docs:
    • Initialization (updated sample that was using jQuery);
    • Added "breaking change" notice to "Character counter" section;
    • Updated references from "data-length" to "maxlength";
    • Updated initialization script.

Screenshots (if appropriate) or codepen:

Here is an example of working instances of "CharacterCounter".

Example of character counter being applied to an input text field (with naximum length of 10) and to a textarea element (with maximum length of 120 characters).

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).

Checklist:

  • I have read the CONTRIBUTING document.
  • My commit messages follows the conventional commit format
  • My change requires a change to the documentation, and updated it accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

- CharacterCounter accepts "maxlength" attr instead of "data-length";
- "data-length" attribute has been deprecated.
- Replaced references to "data-length" by "maxlength";
- Added "change warning" to CharacterCounter section;
- Fixed component initialization in docs init script;
- Updated "initialization" samples.
- Added tests to cover "CharacterCounter" component:
    - Updated HTML fixture (forms);
    - Added initialization test;
    - Added "counter" exhibition test.
@mauromascarenhas mauromascarenhas changed the title Character counter length Replace character counter "data-length" attribute Jun 14, 2023
wuda-io
wuda-io previously approved these changes Jun 22, 2023
Copy link
Member

@wuda-io wuda-io left a comment

Choose a reason for hiding this comment

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

LGTM

@wuda-io wuda-io merged commit ee68fac into materializecss:v2-dev Jun 22, 2023
@mauromascarenhas mauromascarenhas deleted the character-counter-length branch June 23, 2023 03:52
@wuda-io wuda-io mentioned this pull request Jul 12, 2023
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.

2 participants