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

feat: expose location and modifiers on before-input-event #29850

Merged
merged 3 commits into from Jul 14, 2021
Merged

Conversation

@nornagon
Copy link
Member

@nornagon nornagon commented Jun 22, 2021

Description of Change

This adds two new values to the before-input-event details object: location
and modifiers. The latter matches the existing behavior of InputEvent,
previously only used for creating input events (e.g. with
WebContents.sendInputEvent).

Closes #29845

Checklist

Release Notes

Notes: Added location and modifiers to the event properties provided in the 'before-input-event' WebContents event.

zcbenz
zcbenz approved these changes Jul 7, 2021
ckerr
ckerr approved these changes Jul 12, 2021
Copy link
Member

@ckerr ckerr left a comment

API looks fine

Loading

@zcbenz zcbenz merged commit 4d0475c into main Jul 14, 2021
14 of 16 checks passed
Loading
@zcbenz zcbenz deleted the input-event-modifiers branch Jul 14, 2021
@release-clerk
Copy link

@release-clerk release-clerk bot commented Jul 14, 2021

Release Notes Persisted

Added location and modifiers to the event properties provided in the 'before-input-event' WebContents event.

Loading

dict.Set("alt", (in.GetModifiers() & Modifiers::kAltKey) != 0);
dict.Set("meta", (in.GetModifiers() & Modifiers::kMetaKey) != 0);
dict.Set("location", GetKeyLocationCode(in));
dict.Set("_modifiers", in.GetModifiers());
Copy link
Contributor

@poiru poiru Aug 3, 2021

Choose a reason for hiding this comment

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

@nornagon Curious why this is exposed?

Loading

Copy link
Member Author

@nornagon nornagon Aug 3, 2021

Choose a reason for hiding this comment

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

I left it as an escape hatch in case there are other modifiers which we don't currently expose elsewhere that an app wants to detect. It's undocumented, but this makes it possible to build a workaround in older versions of the app for detecting unsupported modifiers while we add support to newer versions.

Loading

BlackHole1 added a commit to BlackHole1/electron that referenced this issue Aug 30, 2021
…9850)

* feat: expose location and modifiers on before-input-event

* lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants