Skip to content

Commit

Permalink
MDL-71672 atto_equation: Fix the markup and the initial focused element
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rezaies committed Jul 19, 2021
1 parent fd18007 commit 902ab1e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions lib/editor/atto/plugins/equation/lib.php
Expand Up @@ -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',
Expand Down
Expand Up @@ -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}}' +
Expand All @@ -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}}' +
Expand Down Expand Up @@ -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) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 902ab1e

Please sign in to comment.