Skip to content

Commit

Permalink
Fixed welcome page tab navigation a11y issue. (#2015)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyanziano committed Dec 9, 2019
1 parent b20fa50 commit 9ee0b73
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 103 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [2010](https://github.com/microsoft/BotFramework-Emulator/pull/2010)
- [2012](https://github.com/microsoft/BotFramework-Emulator/pull/2012)
- [2014](https://github.com/microsoft/BotFramework-Emulator/pull/2014)
- [2015](https://github.com/microsoft/BotFramework-Emulator/pull/2015)
- [2017](https://github.com/microsoft/BotFramework-Emulator/pull/2017)
- [2019](https://github.com/microsoft/BotFramework-Emulator/pull/2019)

Expand Down
2 changes: 1 addition & 1 deletion packages/app/client/src/ui/editor/emulator/emulator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import { Activity } from 'botframework-schema';
import { createDirectLine } from 'botframework-webchat';
import { DirectLine } from 'botframework-directlinejs';
import { isMac } from '@bfemulator/app-shared';
import { CommandServiceImpl, CommandServiceInstance, EmulatorMode, uniqueId, uniqueIdv4 } from '@bfemulator/sdk-shared';
import { SplitButton, Splitter } from '@bfemulator/ui-react';
import base64Url from 'base64url';
Expand All @@ -48,7 +49,6 @@ import {

import { Document, SplitterSize } from '../../../state/reducers/editor';
import { debounce } from '../../../utils';
import { isMac } from '../../../../../main/src/utils/platform';

import { ChatPanelContainer } from './chatPanel';
import LogPanel from './logPanel/logPanel';
Expand Down
5 changes: 2 additions & 3 deletions packages/app/client/src/utils/eventHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
import { Notification, NotificationType, SharedConstants } from '@bfemulator/app-shared';
import { isLinux, isMac, Notification, NotificationType, SharedConstants } from '@bfemulator/app-shared';
import { CommandServiceImpl, CommandServiceInstance } from '@bfemulator/sdk-shared';
import { remote } from 'electron';

import { isMac } from '../../../../app/main/src/utils/platform';
const maxZoomFactor = 3; // 300%
const minZoomFactor = 0.25; // 25%;
class EventHandlers {
Expand Down Expand Up @@ -136,7 +135,7 @@ class EventHandlers {
}
}

if (isMac()) {
if (isMac() || isLinux()) {
const tabPressed: boolean = key === 'tab';
const lastDecendants = EventHandlers.getLastDecendants(document.querySelector('main'));
const firstElement = document.querySelector('nav').firstElementChild as HTMLElement;
Expand Down
3 changes: 1 addition & 2 deletions packages/app/main/src/appMenuBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import { BotInfo, SharedConstants, UpdateStatus } from '@bfemulator/app-shared';
import { BotInfo, isMac, SharedConstants, UpdateStatus } from '@bfemulator/app-shared';
import { CommandServiceImpl, CommandServiceInstance, ConversationService } from '@bfemulator/sdk-shared';
import { app, clipboard, Menu, MenuItem, MenuItemConstructorOptions, shell } from 'electron';

Expand All @@ -40,7 +40,6 @@ import { BotHelpers } from './botHelpers';
import { Emulator } from './emulator';
import { rememberTheme } from './state/actions/windowStateActions';
import { TelemetryService } from './telemetry';
import { isMac } from './utils';
import { store } from './state';
import { getLocalhostServiceUrl } from './utils/getLocalhostServiceUrl';
import { getCurrentConversationId } from './state/helpers/chatHelpers';
Expand Down
3 changes: 1 addition & 2 deletions packages/app/main/src/commands/botCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

import * as path from 'path';

import { BotInfo, getBotDisplayName, SharedConstants } from '@bfemulator/app-shared';
import { BotInfo, getBotDisplayName, isMac, SharedConstants } from '@bfemulator/app-shared';
import {
BotConfigWithPath,
Command,
Expand All @@ -52,7 +52,6 @@ import { store } from '../state/store';
import { BotHelpers } from '../botHelpers';
import { Emulator } from '../emulator';
import { TelemetryService } from '../telemetry';
import { isMac } from '../utils';
import { botProjectFileWatcher, chatWatcher, transcriptsWatcher } from '../watchers';
import { CredentialManager } from '../credentialManager';

Expand Down
4 changes: 2 additions & 2 deletions packages/app/main/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import './commands';
import * as path from 'path';
import * as url from 'url';

import { newNotification, Notification, PersistentSettings, SharedConstants } from '@bfemulator/app-shared';
import { isMac, newNotification, Notification, PersistentSettings, SharedConstants } from '@bfemulator/app-shared';
import { app, BrowserWindow, Rectangle, screen, systemPreferences } from 'electron';
import { CommandServiceImpl, CommandServiceInstance } from '@bfemulator/sdk-shared';

Expand All @@ -48,7 +48,7 @@ import { azureLoggedInUserChanged } from './state/actions/azureAuthActions';
import { rememberBounds } from './state/actions/windowStateActions';
import { dispatch, getSettings, store } from './state/store';
import { TelemetryService } from './telemetry';
import { botListsAreDifferent, ensureStoragePath, isMac, saveSettings, writeFile } from './utils';
import { botListsAreDifferent, ensureStoragePath, saveSettings, writeFile } from './utils';
import { openFileFromCommandLine } from './utils/openFileFromCommandLine';
import { sendNotificationToClient } from './utils/sendNotificationToClient';
import { WindowManager } from './windowManager';
Expand Down
1 change: 0 additions & 1 deletion packages/app/main/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export * from './getSafeBotName';
export * from './isDev';
export * from './loadSettings';
export * from './parseActivitiesFromChatFile';
export * from './platform';
export * from './readFileSync';
export * from './saveSettings';
export * from './sendErrorResponse';
Expand Down
55 changes: 0 additions & 55 deletions packages/app/main/src/utils/platform.spec.ts

This file was deleted.

36 changes: 0 additions & 36 deletions packages/app/main/src/utils/platform.ts

This file was deleted.

43 changes: 42 additions & 1 deletion packages/app/shared/src/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@
import { BotConfigWithPath } from '@bfemulator/sdk-shared';
import { IEndpointService, ServiceTypes } from 'botframework-config/lib/schema';

import { isObject, deepCopySlow, newBot, newEndpoint, getFirstBotEndpoint, newNotification } from './utils';
import {
isObject,
deepCopySlow,
isLinux,
isMac,
newBot,
newEndpoint,
getFirstBotEndpoint,
newNotification,
} from './utils';
import { NotificationType } from './types';

describe('utility function tests', () => {
Expand Down Expand Up @@ -127,3 +136,35 @@ describe('utility function tests', () => {
expect(notif.type).toBe(NotificationType.Info);
});
});

describe('isMac() and isLinux()', () => {
let originalPlatform;

beforeEach(() => {
originalPlatform = process.platform;
});

afterEach(() => {
Object.defineProperty(process, 'platform', { value: originalPlatform });
});

it('returns true when platform is darwin', () => {
Object.defineProperty(process, 'platform', { value: 'darwin' });
expect(isMac()).toBe(true);
});

it('returns false when platform is not darwin', () => {
Object.defineProperty(process, 'platform', { value: 'something-else' });
expect(isMac()).toBe(false);
});

it('returns true when platform is linux', () => {
Object.defineProperty(process, 'platform', { value: 'linux' });
expect(isLinux()).toBe(true);
});

it('returns false when platform is not linux', () => {
Object.defineProperty(process, 'platform', { value: 'something-else' });
expect(isLinux()).toBe(false);
});
});
8 changes: 8 additions & 0 deletions packages/app/shared/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,11 @@ export function traceContainsDebugData(trace: Activity): boolean {
const valueTypeByte = trace ? ~~ValueTypesMask[trace.valueType] : 0;
return !!((ValueTypesMask.BotState | ValueTypesMask.Command | ValueTypesMask.Activity) & valueTypeByte);
}

export function isMac() {
return process.platform === 'darwin';
}

export function isLinux() {
return process.platform === 'linux';
}

0 comments on commit 9ee0b73

Please sign in to comment.