Opened 14 years ago

Closed 13 years ago

#6158 closed Bug (invalid)

Scrolling problem with simulated spacebar keypress on Gecko

Reported by: cwgordon7 Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

I'm not entirely sure this is a problem with CKEditor, and I apologize for wasting your time if it isn't.

We wrote a custom plugin for CKEditor that I think might ultimately be the cause of our problem. The problem is that on Firefox, these line of code in plugins/wysiwygarea/plugin.inc:

// Simulating keyboard character input by dispatching a keydown of white-space text.
var keyEventSimulate = domDocument.$.createEvent( "KeyEvents" );
keyEventSimulate.initKeyEvent( 'keypress', true, true, domWindow.$, false,
false, false, false, 0, 32 );
domDocument.$.dispatchEvent( keyEventSimulate );

trigger a keypress event firing the spacebar. When the spacebar is pressed, the default browser behavior is to scroll down the page. The page thus scrolls down as soon as ckeditor reaches this point in the code.

The symptoms of this problem appear quite similar to those described in http://dev.ckeditor.com/ticket/4397.

Possible other useful information:

  • We have multiple ckeditor wysiwygs on the same page.

If you think you know what's going on, or you can explain why that spacebar keypress doesn't normally trigger a page scroll down, or you have questions that you need answered to help us debug, that would be great, and we'd be glad to provide you with any information you need.

Thanks!

Change History (2)

comment:1 Changed 14 years ago by Charlie

CKEditor has certain functions in it which prevent the "bubbling" up of key-presses. Look here for the defaults: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.keystrokes

There's a special function (I don't remember where) in CKEditor which can prevent the keypress event from bubbling up to the browser, thus while ck recieves a spacebar event, the browser does not.

Hope that's clear enough and that it helps...Clarify more if you don't think that covers your problem

comment:2 Changed 13 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

I have checked this example in latest CKEditor 3.6.2 and no scrolling in Firefox occurs:

editor.on( 'instanceReady', function( ev )
{
	// Simulating keyboard character input by dispatching a keydown of white-space text.	
	setTimeout(function(){			
		var keyEventSimulate = editor.document.$.createEvent( "KeyEvents" );
		keyEventSimulate.initKeyEvent( 'keypress', true, true, window.document.getElementsByTagName('iframe')[0].contentWindow, false,
		false, false, false, 0, 32 );//also tested with new CKEDITOR.dom.window( window ).$
		editor.document.$.dispatchEvent( keyEventSimulate );
		console.log('done');
	}	
	,1500);	
});

Closing the issue as an invalid.

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