Skip to content

Commit

Permalink
XWIKI-22496: Link dialog option button is not keyboard operable (#3714)
Browse files Browse the repository at this point in the history
* Updated the HTML of the button
* Added this button in the focusList
* Removed weird listeners that would come with this focusList

(cherry picked from commit a25f2b0)
  • Loading branch information
Sereza7 authored and mflorea committed Dec 18, 2024
1 parent 1616dd3 commit ca894d1
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,13 +522,22 @@
return {
id: 'optionsToggle',
type: 'html',
html: '<div class="linkOptionsToggle">' +
html: '<button class="linkOptionsToggle" type="button">' +
'<label class="cke_dialog_ui_labeled_label">' +
'<span class="arrow arrow-right"></span> ' +
CKEDITOR.tools.htmlEncode(editor.localization.get('xwiki-link.options')) +
'</label>' +
'</div>',
'</button>',
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) {
Expand Down

0 comments on commit ca894d1

Please sign in to comment.