Skip to content

Conversation

@travch
Copy link
Contributor

@travch travch commented Jan 30, 2018

This is a one line change to resolve an issue where once a key has been utilized in keyboard.down(), the repeat property on keydown events using the same key will always be set to true. See #1901 for full details.

keyboard.down() and keyboard.up() both use the _pressedKeys Set, however keyboard.down() adds and searches for the key code, whereas keyboard.up() attempts to delete based on the key rather than the key code.

@aslushnikov
Copy link
Contributor

@travch thank you for the PR. Can you please add a test? If you have any questions on tests, feel free to ask.

@travch
Copy link
Contributor Author

travch commented Feb 1, 2018

@aslushnikov test has been added. Please let me know if you need anything specific for the test. Thanks for the awesome library.

await page.goto(server.PREFIX + '/input/textarea.html');
await page.focus('textarea');
await page.keyboard.down('w');
expect(await page.keyboard._pressedKeys.size).toEqual(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

@travch It's really unfortunate to access private field here. Can we come up with a test that uses public API only?

Copy link
Contributor

@JoelEinbinder JoelEinbinder left a comment

Choose a reason for hiding this comment

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

Let's merge this and fix the test later. This is a very good fix. Thanks!

@JoelEinbinder JoelEinbinder merged commit f3ba436 into puppeteer:master Feb 13, 2018
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