Skip to content

Commit

Permalink
Merge pull request #17341 from ckeditor/ck/17339
Browse files Browse the repository at this point in the history
Fix (editor-classic): Excluded modal windows from the Classic Editor's integration between dialogs and the sticky toolbar. Closes #17339.
  • Loading branch information
oleq authored Oct 29, 2024
2 parents 582835a + 47e3f1d commit 3ef74d9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/ckeditor5-editor-classic/src/classiceditorui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ export default class ClassicEditorUI extends EditorUI {

dialogView.on<DialogViewMoveToEvent>( 'moveTo', ( evt, data ) => {
// Engage only when the panel is sticky, and the dialog is using one of default positions.
if ( !stickyPanel.isSticky || dialogView.wasMoved ) {
// Ignore modals because they are displayed on top of the page (and overlay) and they do not collide with anything
// See (https://github.com/ckeditor/ckeditor5/issues/17339).
if ( !stickyPanel.isSticky || dialogView.wasMoved || dialogView.isModal ) {
return;
}

Expand Down
26 changes: 26 additions & 0 deletions packages/ckeditor5-editor-classic/tests/classiceditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,32 @@ describe( 'ClassicEditorUI', () => {
expect( dialogPlugin.view.element.firstChild.style.left ).to.equal( '185px' );
expect( dialogPlugin.view.element.firstChild.style.top ).to.equal( '5px' );
} );

it( 'should not move the dialog if it is a modal', async () => {
editorWithUi.ui.view.stickyPanel.isSticky = true;

dialogPlugin.show( {
label: 'Foo',
isModal: true,
content: dialogContentView,
position: DialogViewPosition.EDITOR_TOP_SIDE
} );

sinon.stub( dialogPlugin.view.element.firstChild, 'getBoundingClientRect' ).returns( {
top: 0,
right: 100,
bottom: 50,
left: 0,
width: 100,
height: 50
} );

// Automatic positioning of the dialog on first show takes a while.
await wait( 20 );

expect( dialogPlugin.view.element.firstChild.style.left ).to.equal( '185px' );
expect( dialogPlugin.view.element.firstChild.style.top ).to.equal( '15px' );
} );
} );
} );

Expand Down

0 comments on commit 3ef74d9

Please sign in to comment.