Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334587 - [client][editor] [firefox] Caret disapears after editor is hidden
Summary: [client][editor] [firefox] Caret disapears after editor is hidden
Status: CLOSED DUPLICATE of bug 337160
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-17 16:33 EST by Felipe Heidrich CLA
Modified: 2011-08-30 10:22 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felipe Heidrich CLA 2011-01-17 16:33:20 EST
In Firefox, if the edtior is hidden by setting display to "none", the caret will not draw once the editor is made visible again.

Paste this in the demo.html:

function test() {
    var parent = document.getElementById("divParent");
    parent.style.display = "none";
    setTimeout(function(){
        parent.style.display = "block";
//        editor._clientDiv.contentEditable = false;
//        editor._clientDiv.contentEditable = true;

    }, 1000);
}
Comment 1 Mark Macdonald CLA 2011-01-26 15:07:16 EST
(In reply to comment #0)
> the caret will not draw once the editor is made visible again.

In addition to that, I also see the Ctrl+C/V shortcuts stop working, and text selection behaves wrong when using the mouse.
Comment 2 Felipe Heidrich CLA 2011-01-27 14:16:25 EST
(In reply to comment #1)
> In addition to that, I also see the Ctrl+C/V shortcuts stop working, and text
> selection behaves wrong when using the mouse.

Does Orion hide/show the editor ?
Comment 3 Silenio Quarti CLA 2011-03-08 16:03:53 EST
Simple test case that shows the problem without using the editor.

<!DOCTYPE html>
<html>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2010."/>
<meta http-equiv="X-UA-Compatible" content="IE=8"/>
<meta http-equiv="PRAGMA" content="NO-CACHE"/>
<meta http-equiv="Expires" content="-1"/>
<title>Caret problem</title>

<script language="javascript" type="text/javascript">

function test() {
    var editor = document.getElementById("editor");
    editor.style.display = "none";
    setTimeout(function(){
        editor.style.display = "block";
    }, 1000);
}

function create() {
	var frame = document.getElementById("editor");
	var frameWindow = frame.contentWindow;
	var frameDocument = frameWindow.document;
	var div = frameDocument.createElement("DIV");
	div.style.width = "100%";
	div.style.height = "100%";
	div.style.backgroundColor = "yellow";
	div.innerHTML = "Note the caret blinking. Press the button below to hide the IFRAME. Note that the caret is gone once the IFRAME is shown again (after 1 second). Clicking on the div does not bring the caret back.";
	frameDocument.body.appendChild(div);
	div.contentEditable = "true";
	div.focus();
}

</script>
</head>
<body>

<h1>Problem</h1>

<iframe id='editor' onload="create()" style="width:400px;height:400px;"></iframe>
</iframe>
<br>
<span onclick='test()' style="color:red;">HIDE BUTTON</span>

<br>
</body>
</html>
Comment 4 Ehsan Akhgari CLA 2011-03-11 11:46:40 EST
This is a bug in Gecko: https://bugzilla.mozilla.org/show_bug.cgi?id=407127

I have a set of patches in that bug which should fix this issue.  Test builds including these patches are available at <https://ftp.mozilla.org/pub/mozilla.org/firefox/tryserver-builds/eakhgari@mozilla.com-e6fb454fa6db/>.
Comment 5 Felipe Heidrich CLA 2011-06-20 14:49:02 EDT
Im closing this duplicate (but 337160 has more information), sorry for the confusion.

*** This bug has been marked as a duplicate of bug 337160 ***