Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit cba3fb1

Browse files
authored
Merge pull request #244 from ckeditor/t/243
Fix: BalloonPanelView should prevent native #selectstart event. Closes #243.
2 parents c1e6afc + 1d5b030 commit cba3fb1

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/panel/balloon/balloonpanelview.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ export default class BalloonPanelView extends View {
134134

135135
on: {
136136
// https://github.com/ckeditor/ckeditor5-ui/issues/206
137-
mousedown: preventDefault( this )
137+
mousedown: preventDefault( this ),
138+
139+
// https://github.com/ckeditor/ckeditor5-ui/issues/243
140+
selectstart: bind.to( evt => evt.preventDefault() )
138141
}
139142
} );
140143
}

tests/panel/balloon/balloonpanelview.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,17 @@ describe( 'BalloonPanelView', () => {
127127
view.element.dispatchEvent( evt );
128128
sinon.assert.calledOnce( spy );
129129
} );
130+
131+
// https://github.com/ckeditor/ckeditor5-ui/issues/243
132+
it( 'prevents default on #selectstart', () => {
133+
const event = new Event( 'selectstart', { bubbles: true } );
134+
const spy = sinon.spy( event, 'preventDefault' );
135+
const child = document.createElement( 'div' );
136+
137+
view.element.appendChild( child );
138+
child.dispatchEvent( event );
139+
sinon.assert.calledOnce( spy );
140+
} );
130141
} );
131142
} );
132143

0 commit comments

Comments
 (0)