Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move focus style manager to its own file #308

Merged
merged 2 commits into from
Dec 5, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/core/src/accessibility/focusStyleManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2015 Palantir Technologies, Inc. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2016

* Licensed under the BSD-3 License as modified (the “License”); you may obtain a copy
* of the license at https://github.com/palantir/blueprint/blob/master/LICENSE
* and https://github.com/palantir/blueprint/blob/master/PATENTS
*/

import { InteractionModeEngine } from "../common/interactionMode";

export const FOCUS_DISABLED_CLASS = "pt-focus-disabled";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably live in the Classes export... but unfortunately that would be a small breaking change.

Copy link
Contributor

@giladgray giladgray Dec 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could keep this line marked deprecated.

/** @deprecated */
export const FOCUS_DISABLED_CLASS = Classes.FOCUS_DISABLED_CLASS;


const focusEngine = new InteractionModeEngine(document.documentElement, FOCUS_DISABLED_CLASS);

export const FocusStyleManager = {
alwaysShowFocus: () => focusEngine.stop(),
isActive: () => focusEngine.isActive(),
onlyShowFocusOnTabs: () => focusEngine.start(),
};
8 changes: 8 additions & 0 deletions packages/core/src/accessibility/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright 2015 Palantir Technologies, Inc. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2016

* Licensed under the BSD-3 License as modified (the “License”); you may obtain a copy
* of the license at https://github.com/palantir/blueprint/blob/master/LICENSE
* and https://github.com/palantir/blueprint/blob/master/PATENTS
*/

export * from "./focusStyleManager";
13 changes: 1 addition & 12 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,8 @@
* and https://github.com/palantir/blueprint/blob/master/PATENTS
*/

export * from "./accessibility";
export * from "./common"
export * from "./components";
export { IconClasses } from "./generated/iconClasses";
export { IconContents } from "./generated/iconStrings";

import { InteractionModeEngine } from "./common/interactionMode";

export const FOCUS_DISABLED_CLASS = "pt-focus-disabled";

const focusEngine = new InteractionModeEngine(document.documentElement, FOCUS_DISABLED_CLASS);

export const FocusStyleManager = {
alwaysShowFocus: () => focusEngine.stop(),
isActive: () => focusEngine.isActive(),
onlyShowFocusOnTabs: () => focusEngine.start(),
};