Skip to content

Commit e06ae4c

Browse files
sims-smisHardikGoyal2003seanlip
authored
Fix oppia#21068: Replaced focus() with click() for 's' key shortcut on Library and Exploration Player pages to skip to main content (oppia#21236)
* fix-21068 changed focus() to click() for s-key shortcut * updated accessibility test for 's' key * updated accessibility test for 's' key * updated logged-out-user.ts to check focus on main content --------- Co-authored-by: Hardik Goyal <[email protected]> Co-authored-by: Sean Lip <[email protected]>
1 parent 3367abd commit e06ae4c

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

core/templates/services/keyboard-shortcut.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class KeyboardShortcutService {
4545
'.oppia-skip-to-content'
4646
) as HTMLElement;
4747
if (skipButton !== null) {
48-
skipButton.focus();
48+
skipButton.click();
4949
}
5050
});
5151

@@ -117,7 +117,7 @@ export class KeyboardShortcutService {
117117
'.oppia-skip-to-content'
118118
) as HTMLElement;
119119
if (skipButton !== null) {
120-
skipButton.focus();
120+
skipButton.click();
121121
}
122122
});
123123

core/tests/puppeteer-acceptance-tests/utilities/user/logged-out-user.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ const ratingContainerSelector = '.e2e-test-info-card-rating span:nth-child(2)';
355355
const LABEL_FOR_SUBMIT_BUTTON = 'Submit and start contributing';
356356
const desktopNavbarButtonsSelector = '.oppia-navbar-tab-content';
357357
const mobileNavbarButtonSelector = '.text-uppercase';
358-
const skipLinkSelector = '.e2e-test-skip-link';
358+
const mainContentSelector = '.e2e-test-main-content';
359359
const openMobileNavbarMenuButton = '.oppia-navbar-menu-icon';
360360
const closeMobileNavbarMenuButton = '.oppia-navbar-close-icon';
361361
const lessonLanguageSelector = '.oppia-content-language-selector';
@@ -3881,7 +3881,7 @@ export class LoggedOutUser extends BaseUser {
38813881
expectedFocusedElement = await this.page.$(searchInputSelector);
38823882
break;
38833883
case 's':
3884-
expectedFocusedElement = await this.page.$(skipLinkSelector);
3884+
expectedFocusedElement = await this.page.$(mainContentSelector);
38853885
break;
38863886
case 'c':
38873887
expectedFocusedElement = await this.page.$(

core/tests/webdriverio/accessibility.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ describe('screenreader and keyboard user accessibility features', function () {
8484
it('should skip to the main content element', async function () {
8585
await libraryPage.get();
8686
await browser.keys('s');
87-
var skipLink = $('.e2e-test-skip-link');
88-
await action.click('Skip link', skipLink);
8987
var mainContent = $('.e2e-test-main-content');
9088
expect(await mainContent.isFocused()).toEqual(true);
9189
});
@@ -457,8 +455,8 @@ describe('screenreader and keyboard user accessibility features', function () {
457455

458456
await libraryPage.get();
459457
await waitFor.pageToFullyLoad();
460-
var skipLink = $('.e2e-test-skip-link');
461-
await checkActionShortcuts('s', skipLink);
458+
var mainContent = $('.e2e-test-main-content');
459+
await checkActionShortcuts('s', mainContent);
462460

463461
await libraryPage.get();
464462
await waitFor.pageToFullyLoad();
@@ -483,8 +481,8 @@ describe('screenreader and keyboard user accessibility features', function () {
483481
await explorationPlayerPage.expectExplorationToNotBeOver();
484482

485483
// Should test the skip to main content shortcut.
486-
var skipLink = $('.e2e-test-skip-link');
487-
await checkActionShortcuts('s', skipLink);
484+
var mainContent = $('.e2e-test-main-content');
485+
await checkActionShortcuts('s', mainContent);
488486
});
489487

490488
it('should move focus to next and back buttons in exploration player', async function () {

docker/install_node.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)