Skip to content

3.5.0 Input select-on-focus no longer working #5456

Closed
@wKovacs64

Description

@wKovacs64

Current behavior:

Cypress 3.5.0 is no longer behaving the same way as executing outside of Cypress with regards to an input with an onFocus handler implemented as e => e.target.select() (select-on-focus behavior). It does not appear to select the text (the onFocus handler is called, though). The application code has not changed and works "in real life" but fails in Cypress. This worked in Cypress 3.4.1.

Desired behavior:

The behavior should be consistent with running outside of Cypress, as it was in previous versions.

Steps to reproduce: (app code and test code)

App code:

<input defaultValue="42" onFocus={e => e.target.select()} />

Test code:

cy.get('input')
  .should('have.value', '42')
  .click()
  // input has just been focused so its value should now be selected
  // (and thus typing would replace the value, not append to it)
  .type('36')
  // fail - input value is 4236
  .should('have.value', '36');

Reproduction repository:
https://github.com/wKovacs64/cypress-350-select-on-focus

Versions

Cypress 3.5.0
Windows 10, Linux (Circle CI)
Chrome 78, Electron 73

Activity

kuceb

kuceb commented on Oct 24, 2019

@kuceb
Contributor

@wKovacs64 thanks, I'm able to reproduce and working on getting a fix in for the next patch version

added
type: regressionA bug that didn't appear until a specific Cy version release
on Oct 24, 2019
self-assigned this
on Oct 24, 2019
wKovacs64

wKovacs64 commented on Oct 24, 2019

@wKovacs64
Author

Great, thanks @bkucera

cypress-bot

cypress-bot commented on Oct 29, 2019

@cypress-bot
Contributor

The code for this is done in cypress-io/cypress#5496, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

cypress-bot

cypress-bot commented on Oct 29, 2019

@cypress-bot
Contributor

The code for this is done in cypress-io/cypress#5496, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

cypress-bot

cypress-bot commented on Nov 5, 2019

@cypress-bot
Contributor

Released in 3.6.0.

locked as resolved and limited conversation to collaborators on Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: regressionA bug that didn't appear until a specific Cy version releasev3.5.0 🐛Issue present since 3.5.0

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @jennifer-shehane@wKovacs64@kuceb

    Issue actions

      3.5.0 Input select-on-focus no longer working · Issue #5456 · cypress-io/cypress