-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context menu is incorrectly positioned when opened with Shift-F10 #1451
Comments
CKEDITOR handles Shift-F10 and Ctrl-Shift-F10 itself instead of relying on the browser. contextmenu/plugin.js: editor.setKeystroke( CKEDITOR.SHIFT + 121 /*F10*/, 'contextMenu' );
editor.setKeystroke( CKEDITOR.CTRL + CKEDITOR.SHIFT + 121 /*F10*/, 'contextMenu' ); Actually, many browsers support these shortcuts out of the box, emitting May it be possible to employ browser detection here, perhaps enabling custom handling only in |
Thnx @earshinov, I'm able to reproduce the issue. Preferred option is to have the same logic for all browsers, without sniffing - so if the positioning can be fixed let's do this and set it for all browsers. If that would be for some reason impossible, then we can think about falling back to browser sniffing. WorkaroundBased on your preference and your feedback, what I can suggest is to disable our custom handling for non IE browsers. Add below code to your if ( !CKEDITOR.env.ie ) {
config.keystrokes = [
[ CKEDITOR.SHIFT + 121 /*F10*/, null ]
]
} |
There is another possible solution I would like to suggest. Presently, floatpanel/plugin.js: showBlock: function( /* ... */ ) {
// ...
left = position.x + ( offsetX || 0 ) - positionedAncestorPosition.x,
top = position.y + ( offsetY || 0 ) - positionedAncestorPosition.y;
// ...
} This is obviously incorrect. Instead, when mouse coordinates are unavailable, as in keyboard event handlers, CKEDITOR could rely on the position of the text cursor. I guess, Range.getClientRects() can be used for this purpose, which happens to be failrly cross-browser. |
@earshinov thanks for a nice investigation. The fix should be applied in contextmenu plugin and picking position from a range seems like a good idea 👍 The fallback to 0 in the generic plugin is ok, as it's not only used by context menu, but also other ui plugins. I can see that |
Merged into |
Note that you can already have a peek at the working solution in our nightly preview 😉 |
Are you reporting a feature request or a bug?
Bug.
I have not found any relevant issues mentioning context menu and F10.
Reproduction steps
Expected result
The context menu should appear next to the text cursor.
Actual result
The context menu appears somewhere else. In case of the editor on the homepage the menu is opened close to the top left corner of the contents of the editor.
Other details
The text was updated successfully, but these errors were encountered: