Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Fix Function key bubbling for windows #1367
Browse files Browse the repository at this point in the history
* handle the function keys by preventing the default action

* need to check this on Windows later, working again on Mac

* tweak
  • Loading branch information
jasonLaster authored Dec 16, 2016
1 parent 22a6a05 commit a4652c4
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/components/CommandBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,25 @@ const CommandBar = React.createClass({

componentWillUnmount() {
const shortcuts = this.context.shortcuts;
shortcuts.off("F8", this.props.resume);
shortcuts.off("F10", this.props.stepOver);
shortcuts.off(`${ctrlKey}F11`, this.props.stepIn);
shortcuts.off(`${ctrlKey}Shift+F11`, this.props.stepOut);
shortcuts.off("F8");
shortcuts.off("F10");
shortcuts.off(`${ctrlKey}F11`);
shortcuts.off(`${ctrlKey}Shift+F11`);
},

componentDidMount() {
const shortcuts = this.context.shortcuts;
shortcuts.on("F8", this.props.resume);
shortcuts.on("F10", this.props.stepOver);
shortcuts.on(`${ctrlKey}F11`, this.props.stepIn);
shortcuts.on(`${ctrlKey}Shift+F11`, this.props.stepOut);
const handleEvent = (e, func) => {
e.preventDefault();
e.stopPropagation();
func();
};

shortcuts.on("F8", (_, e) => handleEvent(e, this.props.resume));
shortcuts.on("F10", (_, e) => handleEvent(e, this.props.stepOver));
shortcuts.on(`${ctrlKey}F11`, (_, e) => handleEvent(e, this.props.stepIn));
shortcuts.on(`${ctrlKey}Shift+F11`,
(_, e) => handleEvent(e, this.props.stepOut));
},

renderStepButtons() {
Expand Down

0 comments on commit a4652c4

Please sign in to comment.