reverted: --- b/core/modules/contextual/js/toolbar/views/AuralView.js +++ a/core/modules/contextual/js/toolbar/views/AuralView.js @@ -55,11 +55,8 @@ var tabbingContext = this.model.get('tabbingContext'); // Always release an existing tabbing context. if (tabbingContext) { - // Only announce release when the context was active. - if (tabbingContext.active) { - Drupal.announce(this.options.strings.tabbingReleased); - } tabbingContext.release(); + Drupal.announce(this.options.strings.tabbingReleased); } // Create a new tabbing context when edit mode is enabled. if (!this.model.get('isViewing')) { reverted: --- b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php +++ /dev/null @@ -1,97 +0,0 @@ -createUser([ - 'administer blocks', - 'access contextual links', - 'access toolbar', - ]); - $this->drupalLogin($user); - $this->placeBlock('system_powered_by_block', ['id' => 'powered']); - } - - /** - * Test Drupal.announce messages appear. - */ - public function testAnnounceEditMode() { - $web_assert = $this->assertSession(); - $this->drupalGet('user'); - - // After the page loaded we need to additionally wait until the settings - // tray Ajax activity is done. - $web_assert->assertWaitOnAjaxRequest(); - - $this->pressToolbarEditButton(); - $this->assertAnnounceEditMode(); - $this->pressToolbarEditButton(); - $this->assertAnnounceLeaveEditMode(); - $this->pressToolbarEditButton(); - $this->assertAnnounceEditMode(); - } - - /** - * Press the toolbar edit mode. - */ - protected function pressToolbarEditButton() { - $edit_button = $this->getSession()->getPage()->find('css', static::EDIT_BUTTON_SELECTOR); - $edit_button->press(); - } - - /** - * Assert that the correct message was announced when entering edit mode. - */ - protected function assertAnnounceEditMode() { - $web_assert = $this->assertSession(); - // Wait for contextual trigger button. - $web_assert->waitForElementVisible('css', '.contextual trigger'); - $web_assert->elementContains('css', static::ANNOUNCE_SELECTOR, 'Tabbing is constrained to a set of'); - $web_assert->elementNotContains('css', static::ANNOUNCE_SELECTOR, 'Tabbing is no longer constrained by the Contextual module.'); - } - - /** - * Assert that the correct message was announced when leaving edit mode. - */ - protected function assertAnnounceLeaveEditMode() { - $web_assert = $this->assertSession(); - $page = $this->getSession()->getPage(); - // Wait till all the contextual links are hidden. - $page->waitFor(1, function () use ($page, $web_assert) { - return empty($page->find('css', '.contextual .trigger.visually-hidden')); - }); - $web_assert->elementContains('css', static::ANNOUNCE_SELECTOR, 'Tabbing is no longer constrained by the Contextual module.'); - $web_assert->elementNotContains('css', static::ANNOUNCE_SELECTOR, 'Tabbing is constrained to a set of'); - } - -} only in patch2: unchanged: --- a/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php +++ b/core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php @@ -53,11 +53,16 @@ public function testAnnounceEditMode() { // tray Ajax activity is done. $web_assert->assertWaitOnAjaxRequest(); + // Enable edit mode. $this->pressToolbarEditButton(); $this->assertAnnounceEditMode(); + // Disable edit mode. $this->pressToolbarEditButton(); $this->assertAnnounceLeaveEditMode(); + // Enable edit mode again. $this->pressToolbarEditButton(); + // Finally assert that the 'edit mode enabled' announcement is still correct + // after toggling the edit mode at least once. $this->assertAnnounceEditMode(); }