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 input doesn't allow to delete characters if length is greater than maxlength #25420

Closed
teapotd opened this issue Jan 2, 2020 · 3 comments
Closed

Comments

@teapotd
Copy link
Contributor

@teapotd teapotd commented Jan 2, 2020

Servo doesn't allow to delete a character from text input that contains value longer than its maxlength. Other browsers allow it and some WPT tests depend on this behavior (e.g. html/semantics/forms/constraints/tooLong-input-text-delete-manual.html).

Example:
./mach run -d 'data:text/html,<input value="123456" maxlength="3">'
Try to use backspace in this field.

@jdm jdm added this to To do in web-platform-test failures via automation Jan 2, 2020
@jdm jdm added the A-content/dom label Jan 2, 2020
@jdm
Copy link
Member

@jdm jdm commented Jan 2, 2020

Looks like this case is explicitly called out in the code:

let allowed_to_insert_count = if let Some(max_length) = self.max_length {
let len_after_selection_replaced =
self.utf16_len().saturating_sub(self.selection_utf16_len());
if len_after_selection_replaced >= max_length {
// If, after deleting the selection, the len is still greater than the max
// length, then don't delete/insert anything
return;
}

We should definitely ignore any insertions that are beyond the max length, but I think we should be allowing deletions.

@teapotd
Copy link
Contributor Author

@teapotd teapotd commented Jan 10, 2020

@highfive assign me

@highfive highfive added the C-assigned label Jan 10, 2020
@highfive
Copy link

@highfive highfive commented Jan 10, 2020

Hey @teapotd! Thanks for your interest in working on this issue. It's now assigned to you!

@teapotd teapotd mentioned this issue Jan 10, 2020
4 of 4 tasks complete
bors-servo added a commit that referenced this issue Jan 11, 2020
Allow deletions from overflowed textinput

Allow deletions from textinput when the length is greater than the max length.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25420
- [X] There are tests for these changes
bors-servo added a commit that referenced this issue Jan 16, 2020
Allow deletions from overflowed textinput

Allow deletions from textinput when the length is greater than the max length.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25420
- [X] There are tests for these changes
bors-servo added a commit that referenced this issue Jan 16, 2020
Allow deletions from overflowed textinput

Allow deletions from textinput when the length is greater than the max length.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25420
- [X] There are tests for these changes
web-platform-test failures automation moved this from To do to Done Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.