Skip to content

Commit 065245a

Browse files
fix(ui): add ckeditor body element to editor focus trap
Signed-off-by: Christoph Wurst <[email protected]>
1 parent a2cc94f commit 065245a

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/components/Composer.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,12 +1328,13 @@ export default {
13281328
this.saveDraftDebounced()
13291329
},
13301330
1331-
onEditorReady(editor) {
1331+
onEditorReady({ editor, additionalFocusTrap }) {
13321332
this.bodyVal = editor.getData()
13331333
this.insertSignature()
13341334
if (this.smartReply) {
13351335
this.bus.emit('append-to-body-at-cursor', this.smartReply)
13361336
}
1337+
this.$emit('editor-ready', { editor, additionalFocusTrap })
13371338
},
13381339
13391340
onEditorSubmit(editor) {

src/components/NewMessageModal.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
@update:smime-encrypt="patchComposerData({ smimeSign: $event })"
106106
@update:request-mdn="patchComposerData({ requestMdn: $event })"
107107
@draft="onDraft"
108+
@editor-ready="onEditorReady"
108109
@discard-draft="discardDraft"
109110
@upload-attachment="onAttachmentUploading"
110111
@send="onSend"
@@ -168,6 +169,7 @@ export default {
168169
169170
data() {
170171
return {
172+
additionalTrapElements: [],
171173
original: undefined,
172174
draftsPromise: Promise.resolve(),
173175
attachmentsPromise: Promise.resolve(),
@@ -379,6 +381,12 @@ export default {
379381
return this.draftsPromise
380382
},
381383
384+
onEditorReady({ additionalFocusTrap }) {
385+
if (additionalFocusTrap && this.additionalTrapElements.indexOf() === -1) {
386+
this.additionalTrapElements.push(additionalFocusTrap)
387+
}
388+
},
389+
382390
getDataForServer(data) {
383391
const dataForServer = {
384392
...data,

src/components/TextEditor.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,10 @@ export default {
463463
464464
this.bus.on('append-to-body-at-cursor', this.appendToBodyAtCursor)
465465
this.bus.on('insert-text-block', this.insertTextBlock)
466-
this.$emit('ready', editor)
466+
this.$emit('ready', {
467+
editor,
468+
additionalFocusTrap: '.ck-body-wrapper', // For the link picker, which is appended to the HTML body
469+
})
467470
},
468471
469472
onEditorInput(text) {

0 commit comments

Comments
 (0)