Skip to content

Fix: KeyDown repeats while key is held down (not just KeyPress)#2226

Merged
adegeo merged 9 commits intomainfrom
copilot/fix-keydown-repeats-on-hold
Apr 29, 2026
Merged

Fix: KeyDown repeats while key is held down (not just KeyPress)#2226
adegeo merged 9 commits intomainfrom
copilot/fix-keydown-repeats-on-hold

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

Docs incorrectly stated that KeyDown fires only once per keypress. In reality, both KeyDown and KeyPress fire repeatedly at the OS repeat rate while a key is held—KeyUp is the only event that fires exactly once.

KeyDown   ← fires
KeyPress  ← fires
KeyDown   ← repeats while held
KeyPress  ← repeats while held
KeyUp     ← fires once on release

Changes

  • events.md — Fixed bullet stating "The KeyDown event occurs once"; updated table description to clarify repeat behavior; full style-guide edit pass; date updated to 04/20/2026.
  • overview.md — Rewrote the "Order of keyboard events" sequence, which previously implied only KeyPress repeats on hold. Now correctly shows both KeyDown and KeyPress fire on each key-repeat cycle.
  • handling-user-input.md — Fixed KeyDown table row from "Raised only when a key is initially pressed" to reflect the repeat behavior.

Internal previews

📄 File 🔗 Preview link
dotnet-desktop-guide/winforms/controls/handling-user-input.md dotnet-desktop-guide/winforms/controls/handling-user-input
dotnet-desktop-guide/winforms/input-keyboard/events.md dotnet-desktop-guide/winforms/input-keyboard/events
dotnet-desktop-guide/winforms/input-keyboard/overview.md dotnet-desktop-guide/winforms/input-keyboard/overview

Copilot AI linked an issue Apr 20, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix KeyDown event repeating while key is held down Fix: KeyDown repeats while key is held down (not just KeyPress) Apr 20, 2026
Copilot AI requested a review from adegeo April 20, 2026 17:40
@adegeo
Copy link
Copy Markdown
Contributor

adegeo commented Apr 27, 2026

@copilot events are raised, they don't "occur" .. change that back

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot events are raised, they don't "occur" .. change that back

Done — reverted all three table Description cells back to "is raised" in commit 53d7569.

@adegeo adegeo marked this pull request as ready for review April 27, 2026 17:57
Copilot AI review requested due to automatic review settings April 27, 2026 17:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR corrects the Windows Forms keyboard input documentation to accurately describe that both KeyDown and KeyPress can repeat at the OS key-repeat rate while a key is held, and that KeyUp fires once on release.

Changes:

  • Updated the keyboard event order sequence to show that both KeyDown and KeyPress repeat while a key is held.
  • Clarified KeyDown repeat behavior in the keyboard events overview and reference tables.
  • Updated the control authoring input table to reflect KeyDown repeat behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
dotnet-desktop-guide/winforms/input-keyboard/overview.md Fixes the “order of keyboard events” sequence to show both KeyDown and KeyPress repeating while held.
dotnet-desktop-guide/winforms/input-keyboard/events.md Updates KeyDown behavior description, refreshes frontmatter, and adjusts keyboard event table wording.
dotnet-desktop-guide/winforms/controls/handling-user-input.md Corrects the KeyDown row description to reflect repeat behavior while held.

Comment thread dotnet-desktop-guide/winforms/input-keyboard/events.md Outdated
Comment thread dotnet-desktop-guide/winforms/input-keyboard/events.md Outdated
@adegeo adegeo marked this pull request as draft April 27, 2026 19:51
@adegeo
Copy link
Copy Markdown
Contributor

adegeo commented Apr 27, 2026

@copilot let's clean up dotnet-desktop-guide/winforms/input-keyboard/events.md. The table doesn't present well. Let's create sub sections for each event. Lead with a description, then some bullet points about the behavior.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot let's clean up dotnet-desktop-guide/winforms/input-keyboard/events.md. The table doesn't present well. Let's create sub sections for each event. Lead with a description, then some bullet po...

Done in commit 9585953. Replaced the table with three subsections (KeyDown, KeyPress, KeyUp), each leading with a description paragraph followed by bullet points. Also fixed the Caps Lock character code (65, not 97) and the incorrect KeyUp xref while I was there.

Copilot AI requested a review from adegeo April 27, 2026 19:55
@adegeo adegeo marked this pull request as ready for review April 27, 2026 22:53
@adegeo adegeo requested a review from gewarren April 28, 2026 17:25
Comment thread dotnet-desktop-guide/winforms/controls/handling-user-input.md Outdated
Comment thread dotnet-desktop-guide/winforms/input-keyboard/events.md Outdated
Comment thread dotnet-desktop-guide/winforms/input-keyboard/events.md Outdated
Comment thread dotnet-desktop-guide/winforms/input-keyboard/events.md Outdated
Comment thread dotnet-desktop-guide/winforms/input-keyboard/events.md Outdated
adegeo and others added 2 commits April 29, 2026 10:48
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
@adegeo adegeo enabled auto-merge (squash) April 29, 2026 17:50
@adegeo adegeo merged commit 2d01623 into main Apr 29, 2026
8 checks passed
@adegeo adegeo deleted the copilot/fix-keydown-repeats-on-hold branch April 29, 2026 17:56
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.

KeyDown repeats while key is held down

4 participants