From 6ac8cf2d3e72bf7bc3f6314677d3b85b3991acb1 Mon Sep 17 00:00:00 2001 From: shoaibyazdani <46214812+shoaibyazdani@users.noreply.github.com> Date: Tue, 11 Aug 2026 11:21:36 +0500 Subject: [PATCH] docs(browser): clarify special keys supported by userEvent.keyboard (closes #7118) (#10903) --- docs/api/browser/interactivity.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/api/browser/interactivity.md b/docs/api/browser/interactivity.md index 8b76e24e1..69ddff4f3 100644 --- a/docs/api/browser/interactivity.md +++ b/docs/api/browser/interactivity.md @@ -281,7 +281,14 @@ function keyboard(text: string): Promise The `userEvent.keyboard` allows you to trigger keyboard strokes. If any input has a focus, it will type characters into that input. Otherwise, it will trigger keyboard events on the currently focused element (`document.body` if there are no focused elements). -This API supports [user-event `keyboard` syntax](https://testing-library.com/docs/user-event/keyboard). +This API supports [user-event `keyboard` syntax](https://testing-library.com/docs/user-event/keyboard). Common special keys that can be referenced inside the braces include: + +- **Modifiers:** `{Shift}`, `{Control}`, `{Alt}`, `{Meta}` +- **Navigation:** `{ArrowUp}`, `{ArrowDown}`, `{ArrowLeft}`, `{ArrowRight}`, `{Home}`, `{End}`, `{PageUp}`, `{PageDown}` +- **Editing:** `{Backspace}`, `{Delete}`, `{Insert}`, `{Tab}`, `{Enter}`, `{Escape}` +- **Function keys:** `{F1}` through `{F12}` + +Note: The exact set of supported keys may vary depending on the underlying browser provider (Playwright vs WebdriverIO). If a key press doesn't trigger the expected behavior, consult your provider's documentation or file an issue. ```ts import { userEvent } from 'vitest/browser' -- 2.51.2