Skip to content

Conversation

@antidis
Copy link

@antidis antidis commented Jun 12, 2018

When using some of the old examples on the demo page, I found that the page would change location if I hit J or K. This was quite annoying, so this is an attempt to fix that problem.

Although live examples have been removed, I think this is worth adding. Snippets may have demos with form inputs, and it would be messed up to have the page changed unexpectedly when typing.

@pzuraq
Copy link
Contributor

pzuraq commented Jun 12, 2018

I think it would be cleaner to have a checker function that returns true/false rather than calling a callback:

    if(formHasFocus()) {
      this.set('isGoingTo', true);
      later(() => {
        this.set('isGoingTo', false);
      }, 500);
    }

But I'm onboard with the behavior change.

@antidis antidis force-pushed the antidis/fix-keyboard-shortcuts-error branch from da5d711 to e1276fd Compare June 12, 2018 15:53
@antidis
Copy link
Author

antidis commented Jun 12, 2018

Updated to use a function instead.

@antidis
Copy link
Author

antidis commented Jun 12, 2018

The callback method is something I've used a lot, mostly in cases where you may not have the object you're trying to run the function on though.

@pzuraq pzuraq merged commit d6d5555 into ember-learn:master Jun 12, 2018
@dfreeman
Copy link
Contributor

Thanks @antidis!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants