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

C2LC-430: Add keyboard shortcut for the share button #229

Open
wants to merge 2 commits into
base: develop-0.9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions docs/keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ follows.
| Ctrl + Alt + p | playPauseProgram |
| Ctrl + Alt + r | refreshScene |
| Ctrl + Alt + s | stopProgram |
| Ctrl + Alt + z | shareEnvironment |
| < | decreaseProgramSpeed |
| > | increaseProgramSpeed |
| ? | showHide |
Expand Down Expand Up @@ -82,6 +83,7 @@ with the starting key of a sequence. Those key bindings are as follows:
| Alt + p | playPauseProgram |
| Alt + r | refreshScene |
| Alt + s | stopProgram |
| Alt + z | shareEnvironment |
| < | decreaseProgramSpeed |
| > | increaseProgramSpeed |
| ? | showHide |
Expand Down
8 changes: 8 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,9 @@ export class App extends React.Component<AppProps, AppState> {
this.handleChangeCharacterPosition('turnRight');
}
break;
case("shareEnvironment"):
this.handleShareButtonShortcut();
break;
default:
break;
}
Expand Down Expand Up @@ -1006,6 +1009,11 @@ export class App extends React.Component<AppProps, AppState> {
this.setState({keyBindingsEnabled: keyBindingsEnabled});
}

handleShareButtonShortcut = () => {
const currentUrl = document.location.href;
return navigator.clipboard.writeText(currentUrl);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean there's no onscreen or announced feedback? It seems like there should be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't we say that the shortcut will just copy the url to the clipboard without the feedback message? And communicate more clearly with the name used in grid key for the switches, like "copy the current url"?

Copy link
Contributor

Choose a reason for hiding this comment

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

I still like letting people know that they've actually succeeded in hitting the key combination. It doesn't have to be visual feedback, though. Maybe this is a good use case for a preview announcement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that a preview(maybe feedback you mean?) announcement can make this clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I'm still getting them straight in my head, I guess in this case I did mean feedback.

}

render() {
return (
<React.Fragment>
Expand Down
11 changes: 11 additions & 0 deletions src/KeyboardInputSchemes.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export type ActionName =

// Update Program
| "deleteAll"

// Share Environment
| "shareEnvironment"
;

type ActionKeyStep = {
Expand Down Expand Up @@ -274,6 +277,10 @@ const VoiceOverInputScheme: KeyboardInputScheme = Object.assign({
keyDef: { code: "KeyR", key: "r", altKey: true},
actionName: "refreshScene"
},
shareEnvironment: {
keyDef: { code: "KeyZ", key: "z", altKey: true},
actionName: "shareEnvironment"
},
showHide: {
keyDef: { key: "?"},
actionName: "showHide"
Expand Down Expand Up @@ -335,6 +342,10 @@ const NvdaInputScheme = Object.assign({
keyDef: { code: "KeyR", key: "r", altKey: true, ctrlKey: true },
actionName: "refreshScene"
},
shareEnvironment: {
keyDef: { code: "KeyZ", key: "z", altKey: true, ctrlKey: true },
actionName: "shareEnvironment"
},
showHide: {
keyDef: { key: "?", shiftKey: true },
actionName: "showHide"
Expand Down