Skip to content

Commit

Permalink
fix: fix checkbox click events for firefox 129 and up [run ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
AtofStryker committed Sep 16, 2024
1 parent 8eb40d0 commit bcba5ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 5 additions & 1 deletion cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 13.14.3

_Released 9/10/2024 (PENDING)_
_Released 9/24/2024 (PENDING)_

**Bugfixes:**

- Fixed an issue where Firefox was incorrectly mutating the state of click events on checkboxes after Firefox version `129` and up. Addressed in [#30245](/~https://github.com/cypress-io/cypress/pull/30245).

**Dependency Updates:**

Expand Down
7 changes: 3 additions & 4 deletions packages/driver/src/cy/commands/actions/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default function (Commands, Cypress, cy, state, config) {
const isFirefoxBefore91 = Cypress.isBrowser('firefox') && Cypress.browserMajorVersion() < 91
const isFirefoxBefore98 = Cypress.isBrowser('firefox') && Cypress.browserMajorVersion() < 98
const isFirefox106OrLater = Cypress.isBrowser('firefox') && Cypress.browserMajorVersion() >= 106
const isFirefox130OrLater = Cypress.isBrowser('firefox') && Cypress.browserMajorVersion() >= 130
const isFirefox129OrLater = Cypress.isBrowser('firefox') && Cypress.browserMajorVersion() >= 129

const simulateSubmitHandler = function () {
const form = options.$el.parents('form')
Expand Down Expand Up @@ -386,10 +386,9 @@ export default function (Commands, Cypress, cy, state, config) {

keydownEvents = []

// After Firefox 98 and before 130
// After Firefox 98 and before 129
// Firefox doesn't update checkbox automatically even if the click event is sent.
// TODO: verify firefox version this starts happening
if (Cypress.isBrowser('firefox') && !isFirefox130OrLater) {
if (Cypress.isBrowser('firefox') && !isFirefox129OrLater) {
if (event.target.type === 'checkbox') {
event.target.checked = !event.target.checked
} else if (event.target.type === 'radio') { // when checked is false, here cannot be reached because of the above condition
Expand Down
2 changes: 2 additions & 0 deletions packages/server/lib/browsers/firefox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ export async function open (browser: Browser, url: string, options: BrowserLaunc
'-marionette',
'-new-instance',
'-foreground',
// if testing against older versions of Firefox to determine when a regression may have been introduced, uncomment the '-allow-downgrade' flag.
// '-allow-downgrade',
'-start-debugger-server', // uses the port+host defined in devtools.debugger.remote
'-no-remote', // @see /~https://github.com/cypress-io/cypress/issues/6380
],
Expand Down

0 comments on commit bcba5ed

Please sign in to comment.