Issue #2784571 by tedbow, drpal, nod_, naveenvalecha, miteshmap, droplet, Everett Zufelt: Outside-in Accessibility: Allow escape from edit mode with ESC key
parent
c250a53d56
commit
2161fb241d
|
@ -47,7 +47,7 @@
|
|||
|
||||
$element
|
||||
.dialog('option', adjustedOptions)
|
||||
.trigger('dialogContentResize.outsidein');
|
||||
.trigger('dialogContentResize.offcanvas');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,15 +100,15 @@
|
|||
$('.ui-dialog-offcanvas, .ui-dialog-offcanvas .ui-dialog-titlebar').toggleClass('ui-dialog-empty-title', !settings.title);
|
||||
|
||||
$element
|
||||
.on('dialogresize.outsidein', eventData, debounce(bodyPadding, 100))
|
||||
.on('dialogContentResize.outsidein', eventData, handleDialogResize)
|
||||
.trigger('dialogresize.outsidein');
|
||||
.on('dialogresize.offcanvas', eventData, debounce(bodyPadding, 100))
|
||||
.on('dialogContentResize.offcanvas', eventData, handleDialogResize)
|
||||
.trigger('dialogresize.offcanvas');
|
||||
|
||||
$element.dialog('widget').attr('data-offset-' + edge, '');
|
||||
|
||||
$(window)
|
||||
.on('resize.outsidein scroll.outsidein', eventData, debounce(resetSize, 100))
|
||||
.trigger('resize.outsidein');
|
||||
.on('resize.offcanvas scroll.offcanvas', eventData, debounce(resetSize, 100))
|
||||
.trigger('resize.offcanvas');
|
||||
}
|
||||
},
|
||||
'dialog:beforecreate': function (event, dialog, $element, settings) {
|
||||
|
@ -127,8 +127,8 @@
|
|||
},
|
||||
'dialog:beforeclose': function (event, dialog, $element) {
|
||||
if ($element.is('#drupal-offcanvas')) {
|
||||
$(document).off('.outsidein');
|
||||
$(window).off('.outsidein');
|
||||
$(document).off('.offcanvas');
|
||||
$(window).off('.offcanvas');
|
||||
$mainCanvasWrapper.css('padding-' + edge, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,15 @@
|
|||
});
|
||||
});
|
||||
|
||||
$(document).on('keyup.outsidein', function (e) {
|
||||
if (isInEditMode() && e.keyCode === 27) {
|
||||
Drupal.announce(
|
||||
Drupal.t('Exited edit mode.')
|
||||
);
|
||||
toggleEditMode();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets all items that should be toggled with class during edit mode.
|
||||
*
|
||||
|
|
|
@ -112,8 +112,16 @@ class OutsideInBlockFormTest extends OutsideInJavascriptTestBase {
|
|||
// suppressed.
|
||||
$this->openBlockForm($element_selector);
|
||||
|
||||
// Exit edit mode.
|
||||
$this->toggleEditingMode();
|
||||
// Exit edit mode using ESC.
|
||||
$web_assert->elementTextContains('css', '.contextual-toolbar-tab button', 'Editing');
|
||||
$web_assert->elementAttributeContains('css', '#main-canvas', 'class', 'js-outside-in-edit-mode');
|
||||
// Simulate press the Escape key.
|
||||
$this->getSession()->executeScript('jQuery("body").trigger(jQuery.Event("keyup", { keyCode: 27 }));');
|
||||
$this->waitForOffCanvasToClose();
|
||||
$this->getSession()->wait(100);
|
||||
$web_assert->elementTextContains('css', '#drupal-live-announce', 'Exited edit mode.');
|
||||
$web_assert->elementTextNotContains('css', '.contextual-toolbar-tab button', 'Editing');
|
||||
$web_assert->elementAttributeNotContains('css', '#main-canvas', 'class', 'js-outside-in-edit-mode');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue