Skip to content
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

StickyPanel behaves weird inside overflowed element #5465

Closed
oskarwrobel opened this issue Jun 4, 2018 · 9 comments · Fixed by #14560
Closed

StickyPanel behaves weird inside overflowed element #5465

oskarwrobel opened this issue Jun 4, 2018 · 9 comments · Fixed by #14560
Assignees
Labels
package:ui squad:features Issue to be handled by the Features team. support:2 An issue reported by a commercially licensed client. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@oskarwrobel
Copy link
Contributor

StickyPanel should listen to scroll event of all of its ancestors not only on the window object.
The same as BalloonPanelView does: https://github.com/ckeditor/ckeditor5-ui/blob/beb9f96615da05f22166fb8ddfa7838333b1b61f/src/panel/balloon/balloonpanelview.js#L326-L340 (we can consider moving this listener from BPV to some util).

Besides panel should take only the visible part of the limiter rect into consideration.

Now when classic editor is inside overflowed container then sticky top bar behaves weird.

jun-04-2018 15-53-58

@ma2ciek
Copy link
Contributor

ma2ciek commented Sep 26, 2018

@gauravjain028
Copy link

@oleq Is it possible to fix by overriding something in my build ?

@mlewand mlewand transferred this issue from ckeditor/ckeditor5-ui Oct 9, 2019
@mlewand mlewand added this to the nice-to-have milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:bug This issue reports a buggy (incorrect) behavior. package:ui labels Oct 9, 2019
@lslowikowska lslowikowska added the support:2 An issue reported by a commercially licensed client. label Nov 14, 2019
@petrvorobev
Copy link

confirmed

@Reinmar Reinmar added the squad:core Issue to be handled by the Core team. label Dec 16, 2020
@akhilxavierm
Copy link

This CSS would fix the issue
.ck .ck-sticky-panel .ck-sticky-panel__content_sticky{ position: static !important; }

@flyher
Copy link

flyher commented Jul 21, 2021

This CSS would fix the issue
.ck .ck-sticky-panel .ck-sticky-panel__content_sticky{ position: static !important; }

Thanks @akhilxavierm , this works well.
Maybe we can add the following css to solved the issue temporary.

// default global
.ck .ck-sticky-panel .ck-sticky-panel__content_sticky {
    position: static !important;
}

// blur
.ck-editor__top {
      height: 1px;
      overflow: hidden;
}

// focus
.ck-editor__top {
      display: block;
      height: 38.67px;
      .ck-sticky-panel__placeholder {
        display: none !important;
      }
}

@robclancy
Copy link

We come up with issues, not sure if related to this or the many other issues I have read, where it just doesn't work properly if you don't use the overflow on the body element.

But just using CSS sticky on the classic and document editors seems to have worked fine.

I disabled the sticky panel by doing:

editor.ui.view.stickyPanel.unbind('isActive');
editor.ui.view.stickyPanel.isActive = false;

And added the following CSS (tailwind but self explanatory):

.ck-editor__top {
  @apply sticky top-0 z-10 !important;
}

.ck-sticky-panel__content {
  @apply static !important;
}

@pomek pomek removed this from the nice-to-have milestone Feb 21, 2022
@mlewand mlewand added squad:features Issue to be handled by the Features team. and removed squad:core Issue to be handled by the Core team. labels Jun 9, 2023
@michalbilik
Copy link

This issue is still reproducible on the master branch.

Steps:
1. In the all-features.html manual test, add the following style:

.container {
width: 500px;
height: 700px;
border: 1px solid #ccc;
overflow: auto;
}

2. Wrap the <div id="editor"> with a <div class="container">

3. Run the test with yarn manual --files=ckeditor5

4. Scroll inside the editor 

5. Click outside of the editor and then click back inside the editor. The toolbar will appear at the top above the buttons and won't follow the scroll.

This issue occurs in both Firefox and Safari.

Screen.Recording.2023-06-26.at.10.41.45.mov

@Dumluregn
Copy link
Contributor

The initial scope is timeboxed discovery for 2 solutions:

  1. Fix in sticky toolbar itself
  2. Merge with the balloon system*
  • If we go with this solution, once toolbar becomes sticky, the balloon will need to be repositioned after each 1px viewport change, so it may be costly. It's also debounced, so it may look weird.

Option 1 sounds like a cheaper and UX-safer one.

@CKEditorBot CKEditorBot added the status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. label Jun 29, 2023
@Dumluregn Dumluregn self-assigned this Jun 29, 2023
@CKEditorBot CKEditorBot added status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. and removed status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. labels Jun 29, 2023
oleq added a commit that referenced this issue Jul 12, 2023
…ed-ancestors

Fix (ui): Fixed the sticky panel behavior in overflowing containers. Closes #5465.
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Jul 12, 2023
@CKEditorBot CKEditorBot added this to the iteration 65 milestone Jul 12, 2023
@oleq
Copy link
Member

oleq commented Jul 13, 2023

For anyone interested, the long–awaited fix for this issue will land in the upcoming release of CKEditor 5 🙂

2023-07-13 13 57 25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:ui squad:features Issue to be handled by the Features team. support:2 An issue reported by a commercially licensed client. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.