Skip to content

Commit

Permalink
Merge pull request #270 from dof-dss/development
Browse files Browse the repository at this point in the history
Dev to main for release
  • Loading branch information
neilblair authored Apr 18, 2023
2 parents c80d8fe + 740094f commit b466e91
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
19 changes: 15 additions & 4 deletions origins_qa/src/Controller/QaAccountsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,29 @@ public function toggleAll($action) {
'roles' => 'qa'
]);

$success = TRUE;
foreach ($accounts as $account) {
/** @var \Drupal\user\UserInterface $account */
if ($action === 'enable') {
if (!$account->isActive()) {
$account->activate();
$account->save();
try {
$account->activate();
$account->save();
}
catch (\Throwable $error) {
\Drupal::logger('origins_qa')->error("Error when enabling QA Accounts - " . $error);
}
}
}
else {
if ($account->isActive()) {
$account->block();
$account->save();
try {
$account->block();
$account->save();
}
catch (\Throwable $error) {
\Drupal::logger('origins_qa')->error("Error when disabling QA Accounts - " . $error);
}
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions origins_translations/js/origins-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,30 @@
}

function enableMenuUi(i, elm) {
// Enable the button for toggling the menu
let $button = $('.origins-translation-button', elm);
let $menu = $('.origins-translation-menu', elm);

// Aria-expanded attribute on the button is used as
// CSS hook to show/hide the menu.
// CSS hook to show/hide the menu and enable/disable
// keyboard focus on menu links.
$button
.attr('aria-expanded', false)
.removeClass('hidden')
.click(function (e) {
e.preventDefault();
let expanded = $(this).attr('aria-expanded') === 'true' || false;
let tabindex = expanded ? '-1' : '0';
$(this).attr('aria-expanded', !expanded);
$menu.find('a').attr('tabindex', tabindex);
});

// If focus leaves the translation menu, it should close.
$(elm).focusout(function () {
if ($(this).is(':focus-within') !== true) {
// Close it via the button.
$button.attr('aria-expanded', false);
// Ensure menu links cannot receive keyboard focus.
$menu.find('a').attr('tabindex', '-1');
}
});

Expand Down

0 comments on commit b466e91

Please sign in to comment.