From f020bbed33896d5955203615793b6043f3a26a95 Mon Sep 17 00:00:00 2001 From: Sereza7 Date: Thu, 5 Dec 2024 13:40:52 +0100 Subject: [PATCH] XWIKI-22496: Link dialog option button is not keyboard operable * Updated the HTML of the button * Added this button in the focusList * Removed weird listeners that would come with this focusList --- .../src/main/webjar/xwiki-link/plugin.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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) {