Opened 13 years ago

Last modified 13 years ago

#7635 confirmed Bug

FF scrollIntoView doesn't work

Reported by: robmueller Owned by:
Priority: Normal Milestone:
Component: General Version: 3.0
Keywords: Firefox Cc:

Description

  1. Go to http://ckeditor.com/demo
  2. Scroll the editing area to the bottom and click at the end of the document. The insertion point should be at the end now.
  3. Run the following code in console or firebug or via javascript: in the address bar.
var e = CKEDITOR.instances.editor1; var d = e.document; var r = new CKEDITOR.dom.range(d); r.selectNodeContents(d.getBody()); r.collapse(true); r.select(); e.focus(); e.getSelection().scrollIntoView(); 

In FF4, the cursor doesn't scroll into view, but if you use the scrollbar of the editor to scroll up, you'll see the cursor is at the beginning of the document.

Change History (5)

comment:1 Changed 13 years ago by Jakub Ś

Keywords: Firefox added
Status: newconfirmed
Summary: FF4 scrollIntoView doesn't workFF scrollIntoView doesn't work
Version: 3.5.33.0

Doesn't work for Firefox 3.6 and 4.

comment:2 Changed 13 years ago by Jakub Ś

  1. The easiest method to reproduce it is to paste the code on replacebycode.html page:
    setTimeout(function(){
    			var e = CKEDITOR.instances.editor1; 
    			var d = e.document; 
    			var r = new CKEDITOR.dom.range(d); 
    			r.selectNodeContents(d.getBody()); 
    			r.collapse(true); 
    			r.select(); 
    			e.focus(); 
    			e.getSelection().scrollIntoView(); 
    			},5000);
    
  1. Paste some long text or many paragraphs to text area.
  2. load the page
  3. scroll to bottom and click behind the last line of text

comment:3 Changed 13 years ago by pmahoney

I am also seeing this behavior in Firefox 5.0, Chrome 12.0.742.112, Safari 5.0.4

I'm using CKEditor 3.5.1 (revision 6398).

I'm testing with this modified version of j.swiderski's script (but in my own application; I don't know where to find the 'replacebycode.html' page). I expect the CKEditor to scroll down, then up, then down again. It only scrolls down and stays down.

var doScroll = function(collapseToStart) {
  var e = CKEDITOR.instances.editor1;
  var d = e.document;
  var r = new CKEDITOR.dom.range(d);
  r.selectNodeContents(d.getBody());
  r.collapse(collapseToStart);
  r.select();
  e.focus();
  e.getSelection().scrollIntoView();
};

var scrollToTop = function() { doScroll(true); };

var scrollToBottom = function() { doScroll(false); };

setTimeout(scrollToBottom, 100);
setTimeout(scrollToTop, 200);
setTimeout(scrollToBottom, 300);

comment:4 Changed 13 years ago by pmahoney

I confirmed this behavior at http://ckeditor.com/demo in Firefox 5 and Chrome 12 using my same script above. The demo is currently running CKEditor 3.6.1 (revision 7072).

comment:5 Changed 13 years ago by Jakub Ś

Just to make sure I have increased amount of time.

setTimeout(scrollToBottom, 2000);
setTimeout(scrollToTop, 3000);
setTimeout(scrollToBottom, 4000);

pmahoney 's TC doesn't work for all versions of Firefox.

About Webkit - it works provided that you put focus in content area by clicking it with mouse first. In my opinion this is more about the fact that Webkit uses first command to gain focus. Only then it executes second (you don't see it because cursor is at the top) and third command. I have used the below code to make sure that I’m right:

setTimeout(scrollToTop, 1500);
setTimeout(scrollToBottom, 2000);
setTimeout(scrollToTop, 3000);
setTimeout(scrollToBottom, 4000);

I remember talking about it but right now I can’t find ticked for it so I have reported this issue here #8169

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy