Opened 6 years ago

Last modified 3 years ago

#10169 confirmed Bug

Editor context menu unavailable when opened outside the body element of the content area

Reported by: SteveB Owned by:
Priority: Normal Milestone:
Component: Core : Pasting Version: 4.0 Beta
Keywords: IBM Cc: angel.koilov@…, Damian, Teresa Monahan, satya_minnekanti@…

Description

I added an Screen shot to make it more simple to understand the ticket.

There is an section where you can enter text at the CKEditor, in the following called content section. If you enter a small text at the content section and leave out enough unfilled place in the content section you can't paste text inside the editor. If you right click in the free place of the content section the browsers default context-menu will be opened but not the context menu of the CKEditor. While the text selection cursor will be changed, the context menu keeps missing.

Attachments (1)

ckEditorBug.jpg (210.1 KB) - added by SteveB 6 years ago.
Missing paste menu at content section of CKEditor

Download all attachments as: .zip

Change History (15)

Changed 6 years ago by SteveB

Attachment: ckEditorBug.jpg added

Missing paste menu at content section of CKEditor

comment:1 Changed 6 years ago by Jakub Ś

Status: newconfirmed
Version: 4.04.0 Beta

Problem can be reproduced from CKEditor 4.0 beta.

This issue has to do with body tag boundaries. When user clicks outside of body, listener responsible isn't fired and browser context menu shows up.
Please note that it isn't hard to click outside of body boundaries - body has margins so if you click in that margin (near scrollbar) you get the same result. The same thing is happening when there is little text in editor - body is smaller than content area.

comment:2 Changed 6 years ago by Angel

Cc: angel.koilov@… added
Version: 4.0 Beta4.1.1

comment:3 Changed 6 years ago by Jakub Ś

Version: 4.1.14.0 Beta

@po_taka please don't change version number - it is used to indicate when problem started occurring.

comment:4 Changed 5 years ago by Jakub Ś

Cc: Damian Teresa Monahan added
Keywords: IBM added

#9493 was marked as duplicate.

Problem can be reproduced in every browser from CKEditor 4.0 beta.

comment:5 Changed 5 years ago by Jakub Ś

Workaround is modifying contents.css file.

  1. Minimum height min-height:200px can be added to .body rule.
  2. Margins and paddings can be removed for body rule.

comment:6 Changed 5 years ago by Jakub Ś

Other tickets that concern same source of the problem: #11792, #10792, #10613, #11280.

comment:7 Changed 4 years ago by Jakub Ś

Drag and Drop gets also affeced by small contentarea.

#12222 was marked as duplicate.

comment:8 Changed 4 years ago by Piotrek Koszuliński

I tried to debug this and found that in v3 we listened on the document when on v4 we listen on the editable.

In branch:t/10169 I proposed switching back to the document, but unfortunately IE11 turned out to be a problem. When the menu is being opened the selection is empty and that causes numerous plugins to fail (workarounded in the second commit).

While the patch seems to be ok, I can see two problems:

  • It will break many 3rd party plugins.
  • It would be much better if there always existed some selection when opening the context menu. So instead of changing other plugins we should try to workaround the empty selection problem in the context menu plugin. But from what I see this may be much harder, because forcing focus didn't help.

comment:9 Changed 4 years ago by Jakub Ś

#7979 was marked as duplicate.

Please see 7979#comment:8 for a proof of concept for fixing this problem. IMHO changing CSS seems to be the best and only way to fix this ticket.

Last edited 4 years ago by Jakub Ś (previous) (diff)

comment:10 Changed 4 years ago by Jakub Ś

#13124 was marked as duplicate.

comment:11 Changed 4 years ago by Satya Minnekanti

Cc: satya_minnekanti@… added

comment:12 Changed 3 years ago by Anna Tomanek

Summary: ContextMenu not at whole ContentSection availableEditor context menu unavailable when opened outside the body element of the content area

comment:13 Changed 3 years ago by Piotrek Koszuliński

Minimum height min-height:200px can be added to .body rule.

While this may be appealing because it seems to be very simple, unfortunately it's not. The body element can be styled in many ways (it can have margins, borders, etc.) what makes it pretty tricky to calculate what should be the min-height. If we'll set it to a too low value it will not cover the entire viewport. If to too high value then scrollbars will appear too often.

A more stable solution could be what I proposed in comment:8, but it requires some tinkering to correctly preset the selection.

comment:14 Changed 3 years ago by Jakub Ś

What makes it pretty tricky to calculate what should be the min-height.

That is correct; you will never get it right. The idea was to make the body higher to cover e.g. 80-90% of initial viewport (people don't resize editor that often). That way you will limit ne number of times when you will not see editor context menu.
I was for min-height or this CSS workaround because they are light-weight comparing to JS solution.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy