Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13695 closed New Feature (invalid)

Calculate baseFloatZIndex on the fly

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


On our site CKEditor is embedded in locations with different z-index values. It is difficult to manage the different baseFloatZIndex values for each editor. We have to keep various css declarations and baseFloatZIndex values in sync.

It would be ideal for CKEditor to dynamically determine the correct z-index of a popup element on the fly whenever it is displayed.

One approach would be to just walk up the tree looking for a parent node with a z-index value that has position (fixed, relative, absolute). Since CKEditor based popups are attached to the document.body directly, you would need to traverse the editor's ancestors to find the earliest element with z-index that has position. The baseFloatZIndex would then just be a single z-index greater.

Change History (4)

comment:1 Changed 8 years ago by Jakub Ś

I'm personally always worried with requests like "CKEditor should search the DOM" because I'm worried with performance (sure that searching the DOM is faster nowadays but still).

On one hand CKEditor could scan the document on page load and set the highest baseFloatZIndex but on the other hand - what if someone’s application displays e.g. editor and some alert above it? How can editor know that it should not cover it?
I personally that the way you are doing it now is the way it should be done: "We have to keep various css declarations and baseFloatZIndex values in sync."

Here are some sample links:

comment:2 Changed 8 years ago by Jakub Ś

Resolution: invalid
Status: newclosed
Version: 4.5.3

I have talked this issue through with my colleagues but we don't see editor being responsible for that. I'm sorry but we are not going to implement this feature.

Editor provides hooks (configuration option in this case) which can be used by application authors. I understand that this can be hard with multi-layer pages but CKEditor can't just assume it has to be on top. There might be cases where such behaviour is not desired.

comment:3 Changed 8 years ago by Jonathan

Is there anyway to change the baseFloatZIndex after the editor has been initialized? This would help in cases where the editor is moved from one part of the DOM to another with a different z-index.

comment:4 Changed 8 years ago by Jakub Ś

Have you tried accessing and changing this property directly e.g. CKEDITOR.instances.editor1.config.baseFloatZIndex = 200;? This is one of these config properties which can be changed once CKEditor was initialized.

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