diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-link/plugin.js b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-link/plugin.js index 72221b52c1c3..9761581394a1 100644 --- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-link/plugin.js +++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-link/plugin.js @@ -522,13 +522,22 @@ return { id: 'optionsToggle', type: 'html', - html: '
' + + html: '
', + '', onLoad: function() { + // Since we do not (and cannot without deeper changes) use the 'button' type, + // we need to add this element explicitely to the Dialog focus list. + // We need to hardcode the position since we do not have access to the setupFocus function to reorder the list + // relative to native tab order. + // The four elements before this button are: display link, page selection *3 + this.getDialog().addFocusable(this.getElement() , 4); + // Without this, the keyboard press on this focusable element will trigger the click twice... + this.getElement().removeAllListeners(); + // We use the CKEDITOR.dom.element event utilities. This `on` is not related to JQuery. this.getElement().on('click', this.toggleLinkOptions, this); }, toggleLinkOptions: function(event) {