Blanks included before the first char when typing in a textarea

Bug #1036 reported by Javier Carranza
10
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Carlos Perelló Marín

Bug Description

When I was trying to translate ddtp-packages-main to es (https://launchpad.ubuntu.com/products/ddtp-packages/05.10/+pots/ddtp-packages-main/es/+translate), I found a bug with the form

When I was trying to translate ddtp-packages-main to es (https://launchpad.ubuntu.com/products/ddtp-packages/05.10/+pots/ddtp-packages-main/es/+translate), I found a bug with the form. In any textarea input, if you type the first char you get some blanks included before it. No more blanks are added until the next textarea input.

Bug in firefox that causes us problems: https://bugzilla.mozilla.org/show_bug.cgi?id=299009

Revision history for this message
Dafydd Harries (daf) wrote :

Could you tell us which web browser you're using?

This may be related to the fix for #710. If it is, we may need to revert the fix and try another approach.

Revision history for this message
NSV (nsv-deactivatedaccount) wrote :

Me, i'm using Firefox and there is this annoying bug.

Revision history for this message
Christian Reis (kiko) wrote :

Has anyone managed to find an easily reproductible situation where this occurs?

Changed in rosetta:
assignee: nobody → carlos
status: New → Accepted
Revision history for this message
Carlos Perelló Marín (carlos) wrote :

Ok, I have a fix for this bug.

The problem is with the way we generate our HTML when using textareas, sometimes, we add extra spaces and newlines.

It should be fixed on Tuesday (perhaps earlier). I'm still working on a way to fix some of the problems introduced by this bug in our database. Not sure if all problems will be fixed automatically, will tell you if we achieve it or if you need to review the translations manually.

Thanks for your patience

Revision history for this message
Christian Reis (kiko) wrote :

I've reviewed the patch. A note to commenters is that we believed initially this to be a browser bug; a related bug therefore is https://bugzilla.mozilla.org/show_bug.cgi?id=299009

Revision history for this message
Carlos Perelló Marín (carlos) wrote :

This bug is not fixed.

Under some situations, we still add whitespaces...

Revision history for this message
Christian Reis (kiko) wrote :

Under which situations? That comment seems to be begging for a question!

Revision history for this message
Carlos Perelló Marín (carlos) wrote :

I was not sure I had time to fix it today before leaving to sleep, so I added that comment to remind me it tomorrow.

I have it fixed now and I'm going to merge it as trivial with a request to get it merged into production tomorrow.

The problem comes with content that does not starts with a newline character (well, the problem is always there if we have any content, but our tests are not able to detect it), as we have some extra whitespaces before the content dump, they are prepended to the real content.

I think you warned me about the problem but as the tests didn't fail I thought it was not a real problem.

I have a test to this concrete case, but it's a bit useless as the pagetests we use ignores extra whitespaces at the begining of a line, so 'foo' and ' foo' are exactly the same.

Revision history for this message
Carlos Perelló Marín (carlos) wrote :

Ok, seems like finally, there is a bug with firefox that introduces extra newlines inside textareas depending on the data it gets to fill that textarea.

You can see the bug report at: https://bugzilla.mozilla.org/show_bug.cgi?id=299009

I think I have a fix for all possible situations with Firefox but it will fail when Firefox is fixed or if the users use another browser that does not have the bug, the problem we will have in that case is that we will lose newlines if they are at the end of the text. For instance:

"Foo
"

Will be submitted as "Foo", it's not a big issue as we don't have too many strings in that situation and our current translation validation code will reject them.

I leave this bug open until I develop a final fix that will prevent this kind of errors so we will handle automatically trailing and leading newlines so the user does not needs to care about them and we will not care at all if the browser is buggy or not. It will take sometime as the change is not trivial but I hope it will be ready next week. In the mean time, the 'fast but not 100% correct fix' should land tomorrow.

Dafydd Harries (daf)
Changed in rosetta:
status: Accepted → Fixed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.