MDL-71672 atto_equation: Fix the markup and the initial focused element

The initial focused element should be the first operator button.
This commit also fixes the accessibility issues that previously were
wrongly fixed by a redundant click on the first tab using javascript.
This commit is contained in:
Shamim Rezaie 2021-06-19 06:59:45 +10:00
parent fd18007c1b
commit 902ab1e2f6
5 changed files with 21 additions and 17 deletions

View file

@ -68,6 +68,7 @@ function atto_equation_params_for_js($elementid, $options, $fpoptions) {
'group1' => array(
'groupname' => 'librarygroup1',
'elements' => get_config('atto_equation', 'librarygroup1'),
'active' => true,
),
'group2' => array(
'groupname' => 'librarygroup2',

View file

@ -75,7 +75,10 @@ var COMPONENTNAME = 'atto_equation',
'<ul class="root nav nav-tabs mb-1" role="tablist">' +
'{{#each library}}' +
'<li class="nav-item">' +
'<a class="nav-link" href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
'<a class="nav-link{{#active}} active{{/active}}" ' +
'{{#active}}aria-selected="true"{{/active}}' +
'{{^active}}aria-selected="false" tabindex="-1"{{/active}}' +
' href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
' data-target="#{{../elementidescaped}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}"' +
' role="tab" data-toggle="tab">' +
'{{get_string groupname ../component}}' +
@ -85,7 +88,7 @@ var COMPONENTNAME = 'atto_equation',
'</ul>' +
'<div class="tab-content mb-1 {{CSS.LIBRARY_GROUPS}}">' +
'{{#each library}}' +
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane" ' +
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane{{#active}} active{{/active}}" ' +
'id="{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}">' +
'<div role="toolbar">' +
'{{#split "\n" elements}}' +
@ -222,14 +225,12 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
focusAfterHide: true,
width: 600,
focusOnShowSelector: SELECTORS.EQUATION_TEXT
focusOnShowSelector: SELECTORS.LIBRARY_BUTTON
});
var content = this._getDialogueContent();
dialogue.set('bodyContent', content);
content.one('.nav-item:first-child .nav-link').getDOMNode().click();
dialogue.show();
// Notify the filters about the modified nodes.
require(['core/event'], function(event) {

View file

@ -75,7 +75,10 @@ var COMPONENTNAME = 'atto_equation',
'<ul class="root nav nav-tabs mb-1" role="tablist">' +
'{{#each library}}' +
'<li class="nav-item">' +
'<a class="nav-link" href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
'<a class="nav-link{{#active}} active{{/active}}" ' +
'{{#active}}aria-selected="true"{{/active}}' +
'{{^active}}aria-selected="false" tabindex="-1"{{/active}}' +
' href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
' data-target="#{{../elementidescaped}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}"' +
' role="tab" data-toggle="tab">' +
'{{get_string groupname ../component}}' +
@ -85,7 +88,7 @@ var COMPONENTNAME = 'atto_equation',
'</ul>' +
'<div class="tab-content mb-1 {{CSS.LIBRARY_GROUPS}}">' +
'{{#each library}}' +
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane" ' +
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane{{#active}} active{{/active}}" ' +
'id="{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}">' +
'<div role="toolbar">' +
'{{#split "\n" elements}}' +
@ -222,14 +225,12 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
focusAfterHide: true,
width: 600,
focusOnShowSelector: SELECTORS.EQUATION_TEXT
focusOnShowSelector: SELECTORS.LIBRARY_BUTTON
});
var content = this._getDialogueContent();
dialogue.set('bodyContent', content);
content.one('.nav-item:first-child .nav-link').getDOMNode().click();
dialogue.show();
// Notify the filters about the modified nodes.
require(['core/event'], function(event) {

View file

@ -73,7 +73,10 @@ var COMPONENTNAME = 'atto_equation',
'<ul class="root nav nav-tabs mb-1" role="tablist">' +
'{{#each library}}' +
'<li class="nav-item">' +
'<a class="nav-link" href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
'<a class="nav-link{{#active}} active{{/active}}" ' +
'{{#active}}aria-selected="true"{{/active}}' +
'{{^active}}aria-selected="false" tabindex="-1"{{/active}}' +
' href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
' data-target="#{{../elementidescaped}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}"' +
' role="tab" data-toggle="tab">' +
'{{get_string groupname ../component}}' +
@ -83,7 +86,7 @@ var COMPONENTNAME = 'atto_equation',
'</ul>' +
'<div class="tab-content mb-1 {{CSS.LIBRARY_GROUPS}}">' +
'{{#each library}}' +
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane" ' +
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane{{#active}} active{{/active}}" ' +
'id="{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}">' +
'<div role="toolbar">' +
'{{#split "\n" elements}}' +
@ -220,14 +223,12 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
focusAfterHide: true,
width: 600,
focusOnShowSelector: SELECTORS.EQUATION_TEXT
focusOnShowSelector: SELECTORS.LIBRARY_BUTTON
});
var content = this._getDialogueContent();
dialogue.set('bodyContent', content);
content.one('.nav-item:first-child .nav-link').getDOMNode().click();
dialogue.show();
// Notify the filters about the modified nodes.
require(['core/event'], function(event) {