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

Fire keyup events for ActionEventBus.keys on document blur #920

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

somaraani
Copy link

@somaraani somaraani commented Feb 11, 2022

Checklist

  • The code has been run through pretty yarn run pretty
  • The tests pass on CircleCI
  • You have referenced the issue(s) or other PR(s) this fixes/relates-to
  • The PR Template has been filled out (see below)
  • Had a beer/coffee because you are awesome

What?

Fire key-up events for all keys in action event bus on document blur

Why?

#919

How?

Iterate through ActionEventBus.keys and fire keyup event on document blur.

Feel good image:

(Add your own one below :])

LOL

@somaraani somaraani changed the title fire keyup event on blur Fire keyup events for ActionEventBus.keys on document blur Feb 11, 2022
@dylanvorster
Copy link
Member

might be better to use, as it covers all cases and not just blur. Can you give this a test?

 document.addEventListener('visibilitychange' ...);
    document.addEventListener('focusin', ...);


document.addEventListener('keyup', this.keyUp);
document.addEventListener('keydown', this.keyDown);
document.addEventListener('blur', this.blur);
Copy link
Member

Choose a reason for hiding this comment

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

see other comments, also this needs to be deregistered in unmount

@@ -80,4 +80,10 @@ export class ActionEventBus {
action.options.fire(actionEvent as any);
}
}

clearKeys() {
_.forEach(Object.keys(this.keys), (key) => {
Copy link
Member

Choose a reason for hiding this comment

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

dont need the Object.keys, _.forEach will give the key as the second param in the callback

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.

None yet

2 participants