Live data from Hacker News

Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

fxsitecompat.dev

21–30 of 145 posts

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#22
post #18

Not sure if this is a title length restriction on HN, but the omitted "...when pasted into..." here seems important.

And "a password field" also.

That's their justification, not a restriction on the change, this impacts non-password fields too.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#23
post #14

Earlier quoted context omitted.

Indeed. I'd suggest a change in this code even if this change in FF hadn't arrived.

I think GP was joking. A far more straightforward way to shorten text to a given length is: const shorten = (text, length) => text.substring(0, length);

Probably way more efficient than relying on a side effect to a DOM update as well.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#24

Earlier quoted context omitted.

A lot of people still put them in forms. They just intercept the form submit to do with as the please. No putting them in a form also breaks accessibility

And a lot of sites don't. "This breaks a ton of things but not everything" isn't a good attitude to browser compatibility, particularly from a browser that already has a small market share. > No putting them in a form also breaks accessibility Nope. Screen readers have no concept of fields, nor any concept of how the piping works below the surface when a is pressed. I run a screen reader every single day.

Am I missing something? This seems less surprising than the alternative.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#25
post #18

Earlier quoted context omitted.

And "a password field" also.

That's their justification, not a restriction on the change, this impacts non-password fields too.

Yeah that's the weird thing. They write "for password fields" and then apply it to non-password fields and even multi-line fields. Have you ever seen a multi-line password field?! I understand that people might abuse for it but that's definitely not the common thing and just crazy talk. It's an excuse but I don't understand the reason behind this change.

I've been setting maxlength to generous values on my fields in applications since I started coding HTML, if now suddenly I have to revisit everything and add JavaScript magic to check form validity where previously the page was completely free of JS, well, I think I'd frankly refuse where possible and tell people to complain to their faulty implementation.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#26
It's fairly common to copy a large amount of text and drop it into an input with length restrictions. For instance, I do it often when I submit HN titles. For regular text, it's a much better UX to be able to paste the whole thing then edit it down to meet the restrictions than to paste and have it auto-truncated.

When it comes to password inputs, where you can't necessarily see what you're pasting, it's extremely important than the user knows when truncation occurs. But could that be achieved while still respecting maxlength? Yes, I think it would be decent UX to alert the user when they attempt to paste text that exceeds the maxlength, without actually completing the paste. That way, the input remains empty so there's no confusion about whether the full password or a truncated password has been entered, and the user can take appropriate action.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#27

> The form cannot be submitted until the user fixes the error, so the server shouldn’t receive an excessively long text or password (a server-side validation has to be put in place anyway.) However, this could potentially affect a front-end implementation if it expects the entered text never to exceed maxlength. What century are Mozilla living in? Most, even simple forms, don't use elements and submit buttons anymore…

You just typed your comment into a

So Mozilla's non-standard compliant change broke one fewer site, problem solved?

Even for this site, why is Mozilla not limiting this breaking change designed to fix password fields to: Password fields. They haven't described why type=text or even textarea should be non-standard, only why type=password should be.

If they limited this to password fields, I'd have no issue. But per the code change they did not.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#28
post #25

Earlier quoted context omitted.

That's their justification, not a restriction on the change, this impacts non-password fields too.

Yeah that's the weird thing. They write "for password fields" and then apply it to non-password fields and even multi-line fields. Have you ever seen a multi-line password field?! I understand that people might abuse for it but that's definitely not the common thing and just crazy talk. It's an excuse but I don't understand the reason behind this change. I've been setting maxlength to generous values on my fields in…

Eh? For what reason you need to add JS? Forms won't submit with overlong text.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#29

> The form cannot be submitted until the user fixes the error, so the server shouldn’t receive an excessively long text or password (a server-side validation has to be put in place anyway.) However, this could potentially affect a front-end implementation if it expects the entered text never to exceed maxlength. What century are Mozilla living in? Most, even simple forms, don't use elements and submit buttons anymore…

Even if you use AJAX forms for logging in or registering (I'd prefer you didn't but whatever), you should still use the proper form validation API for things like this. If you use the proper HTML API for gathering data properly, you're most likely not affected badly functionality wise; only your UI will be affected because the form will refuse to be posted without proper explanation.

If the change really does get bypassed by everyone, that only underlines the sad state of modern website design relying completely on javascript.

I'm not sure why they don't limit this to just passwords but I can imagine it's easier to change the behaviour for all form elements than it is to change the behaviour of just password fields.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#30
post #25

Earlier quoted context omitted.

Yeah that's the weird thing. They write "for password fields" and then apply it to non-password fields and even multi-line fields. Have you ever seen a multi-line password field?! I understand that people might abuse for it but that's definitely not the common thing and just crazy talk. It's an excuse but I don't understand the reason behind this change. I've been setting maxlength to generous values on my fields in…

Eh? For what reason you need to add JS? Forms won't submit with overlong text.

Oh the change is that it'll not cut the user off but show a warning instead? I misread the post then.

Edit: Yes, indeed:

> The form cannot be submitted until the user fixes the error, so the server shouldn’t receive an excessively long text

Thanks for pointing that out!

Post reply on HN