Page MenuHomePhabricator

On enter key press, expand the section in translation column consistently across browsers
Closed, ResolvedPublic

Description

This is follow up of T121092: Multiple paragraphs in a section causes data loss on restoration

When enter key is pressed inside a content editable, browser behavior differs:

BrowserInserts
IEp
Google Chromediv
Firefoxbr

This bug happens if the inserted tag is a section tag. ie p or div. If you do this in Firefox, restoring works fine since it is an br inside paragraph,

Your patch handles the cases of section tags correctly. I tested.

But, having a <div> tag in HTML causes Parsoid to insert the <div> tag in the generated wiki text. And the article published will not have that paragraph break. So the users intention of paragraph break is not accompilished.

HTML

<p>first <div>second </div></p>

Wikitext generated:

first <div>second </div>

If the br tag appears inside the HTML , generated wiki text will have paragraph breaks and hence it satisfies users intention.
HTML

<p>first <br>second<br><br>third</p>
first 
second

third

Ideally, on enter keys, we should close the <p> and insert a new <p> by disallowing both div, and br creation inside <p> tag

That also means, in translation column it is a new section created with a dummy section in source

Event Timeline

santhosh raised the priority of this task from to High.
santhosh updated the task description. (Show Details)
santhosh added a project: ContentTranslation.
santhosh added subscribers: santhosh, Nikerabbit.

From the design perspective, the important aspect is to keep the alignment between the blocks of content in source and target content (regardless of those blocks being supported by one tag or another).

When hitting enter, I'd expect an existing block of content to be expanded not a new block to be created.

All blocks of content in the target translation should map to a block of content in the source. There should not be a way to split blocks or create new blocks without a corresponding source mapping.

Pginer-WMF renamed this task from On enter key press, create a new section in translation column to On enter key press, expand the section in translation column.Dec 11 2015, 10:00 AM

Copying from the older merged task

The simple way to handle this would be to convert each paragraph created in this way to a usual wiki syntax paragraph - with two line breaks to separate the paragraphs and without any markup. (Another option would be to add <br /> tags on every line break, but it makes more sense to avoid adding any HTML markup to the wiki syntax of the published article without a specific need.)

(Another issue that it raises is how to move to the next translatable paragraph using keyboard and not mouse, but that's a topic for a separate design task - T109056.)

Pginer-WMF renamed this task from On enter key press, expand the section in translation column to On enter key press, expand the section in translation column consistently across browsers.Dec 11 2015, 10:01 AM
Arrbee lowered the priority of this task from High to Medium.Jan 18 2016, 6:43 AM

Change 272449 had a related patch set uploaded (by Santhosh):
Consistant line break behavior for sections

https://gerrit.wikimedia.org/r/272449


Screenshot showing a paragraph split restored against source section successfully.

Change 272449 merged by jenkins-bot:
Consistent line break behavior for sections

https://gerrit.wikimedia.org/r/272449

I verified this in production with Chrome and it seems to work—thanks!! It was one of the most annoying things.

Not closing this yet, because I'd love another little round of QA in different browsers.