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

Fix 'e.getModifierState is not a function' error for browser auto filled form events #206883

Merged
merged 4 commits into from
Mar 14, 2024

Conversation

BusinessDuck
Copy link
Contributor

Some browser events may not contains getMidifierState method. For example events, that produced by forms auto-fills.
Check the demo stand in associated issue #205214

Optional chaining for that method should solve the problem.

Test cases:

  1. Autofill form by browser
  2. Create event through the new Event() programmatically and dispatch, that will produce error also because correct way to use new KeyboardEvent()

@Tyriar Tyriar assigned alexdima and unassigned Tyriar Mar 6, 2024
@silverwind
Copy link

silverwind commented Mar 9, 2024

Any chance of a swift merge? The diff is trivial and this issue really affects Monaco users heavily.

@BusinessDuck can you change the PR title to something descriptive? It might be one reason why the PR was ignored so far.

@BusinessDuck BusinessDuck changed the title Update keyboardEvent.ts Fix 'e.getModifierState is not a function' error for browser auto filled form events Mar 9, 2024
@BusinessDuck
Copy link
Contributor Author

Is that looks better now?

@silverwind
Copy link

silverwind commented Mar 9, 2024

Yes, thanks. The fix is good enough to get the error away.

The error also highlights a deeper underlying problem: VSCode should not be "listening in" on events that are targeting elements which are outside of its root element. Essentially, it's being a "bad neighbor" currently.

@alexdima alexdima enabled auto-merge (squash) March 14, 2024 07:03
@vscodenpa vscodenpa added this to the March 2024 milestone Mar 14, 2024
@alexdima
Copy link
Member

Thank you!

@alexdima alexdima merged commit b9ca5a6 into microsoft:main Mar 14, 2024
6 checks passed
@BusinessDuck BusinessDuck deleted the patch-1 branch March 14, 2024 08:55
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants