Closed Bug 2028058 Opened 2 months ago Closed 28 days ago

Can't reliably add new lines in the HTML Editor

Categories

(DevTools :: Inspector, defect, P2)

defect

Tracking

(firefox-esr140 unaffected, firefox149 wontfix, firefox150 wontfix, firefox151 wontfix, firefox152 wontfix, firefox153 fixed)

RESOLVED FIXED
153 Branch
Tracking Status
firefox-esr140 --- unaffected
firefox149 --- wontfix
firefox150 --- wontfix
firefox151 --- wontfix
firefox152 --- wontfix
firefox153 --- fixed

People

(Reporter: nchevobbe, Assigned: jdescottes)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

Steps to reproduce

  1. Navigate to data:text/html,<meta charset=utf8><h1>Hello
  2. Inspect the Hello element
  3. In the markup view, Right click on the <h1> node to edit the html
  4. One the editor is displayed, hit Enter

Expected results

I get a new line at the top of the editor

Actual results

Nothing happens


It used to work in cm5

Set release status flags based on info from the regressing bug 1991431

:bomsy, since you are the author of the regressor, bug 1991431, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Blocks: cm-next
Flags: needinfo?(hmanilla)
Severity: -- → S3
Priority: -- → P2
Flags: needinfo?(hmanilla)

Hi Bomsy,

This is a relatively recent regression set as P2, do you have the bandwidth to take a look or should we go ahead?

Flags: needinfo?(hmanilla)

See above.

Flags: needinfo?(hmanilla)

Taking a look at this one.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

The root cause of the issue is that codemirror6 adds BR elements which don't seem to play nicely with the xhtml document of the markup view.
Specifically this is coming from document.createElement("BR"), which creates <BR> elements which are not recognized in XHTML.

And in general all the node name comparisons in the bundle which use hardcoded uppercase tag names will fail.

It seems like CM6 doesn't intend to support XHTML according to https://discuss.codemirror.net/t/codemirror-6-embedded-in-xhtml/3165/4

I can see a few paths here, not sure which one makes the most sense:

  • wrap CM6 in an iframe when used in the inspector. Should be relatively easy, this is mostly about using appendTo instead of appendToLocalElement, but I'm not sure if this might break some features?
  • monkeypatch cm6 to at least fix the node names to be lowercase. Fixes this issue, but adds recurring maintenance burden and potentially doesn't address all XHTML/CM6 issues
  • migrate inspector/markupview from XHTML to HTML. Potentially the most expensive solution.

I'm uploading patches for the iframe and XHTML -> HTML approaches, let's see what try says for those. We can try monkeypatching if both strategies fail.

Summary: Can't add new line at the top of the HTML Editor → Can't reliably add new lines in the HTML Editor
Attachment #9588975 - Attachment is obsolete: true
Flags: needinfo?(hmanilla)
Status: ASSIGNED → RESOLVED
Closed: 28 days ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.

Moving 152 to wontfix, I prefer to let this bake on nightly as much as possible.

QA Whiteboard: [qa-triage-done-c154/b153]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: