From 355f62bbabe4b3bfc63415febca440d8306c1826 Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Mon, 25 Aug 2025 11:13:46 -0400 Subject: [PATCH 1/2] clarify behavior of keypress/input events --- docs/api/commands/press.mdx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/api/commands/press.mdx b/docs/api/commands/press.mdx index 75ce817591..dc9677790b 100644 --- a/docs/api/commands/press.mdx +++ b/docs/api/commands/press.mdx @@ -12,10 +12,20 @@ componentSpecific: false Trigger native key events in your application to simulate keyboard interactions. -A `keydown`, `press`, and `keyup` event will be dispatched directly to the browser window. +A `keydown` and `keyup` event will be dispatched directly to the browser window. Unlike `cy.type()`, which is best for typing multiple character keys, `cy.press()` will dispatch real keyboard events rather than simulated ones. This command is especially useful when testing focus management and keyboard navigation patterns which are critical for [accessibility testing](/app/guides/accessibility-testing) and great keyboard UX. +:::info + +Behavior divergence for `input`, `keypress` events + +In Firefox, the deprecated `keypress` event will be dispatched between the `keydown and `keyup` events. As well, if an input changes due to these events, the proper `input` event will be dispatched. + +In Chromium, neither the `keypress` nor `input` events will be dispatched. + +::: + :::caution Supported Browsers: From 8e0377ea84200393a5452113058ea964ee465aa1 Mon Sep 17 00:00:00 2001 From: Cacie Prins Date: Mon, 25 Aug 2025 12:37:46 -0400 Subject: [PATCH 2/2] clarify --- docs/api/commands/press.mdx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/docs/api/commands/press.mdx b/docs/api/commands/press.mdx index dc9677790b..e06704bb65 100644 --- a/docs/api/commands/press.mdx +++ b/docs/api/commands/press.mdx @@ -12,20 +12,10 @@ componentSpecific: false Trigger native key events in your application to simulate keyboard interactions. -A `keydown` and `keyup` event will be dispatched directly to the browser window. +A `keydown` and `keyup` event will be dispatched directly to the browser window. If an input changes due to these events, the proper `input` event will be dispatched. Unlike `cy.type()`, which is best for typing multiple character keys, `cy.press()` will dispatch real keyboard events rather than simulated ones. This command is especially useful when testing focus management and keyboard navigation patterns which are critical for [accessibility testing](/app/guides/accessibility-testing) and great keyboard UX. -:::info - -Behavior divergence for `input`, `keypress` events - -In Firefox, the deprecated `keypress` event will be dispatched between the `keydown and `keyup` events. As well, if an input changes due to these events, the proper `input` event will be dispatched. - -In Chromium, neither the `keypress` nor `input` events will be dispatched. - -::: - :::caution Supported Browsers: