Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wKovacs64 opened this issue Oct 24, 2019 · 5 comments · Fixed by #5496
Closed

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

wKovacs64 opened this issue Oct 24, 2019 · 5 comments · Fixed by #5496
Assignees
Labels
type: regression A bug that didn't appear until a specific Cy version release v3.5.0 🐛 Issue present since 3.5.0

Comments

@wKovacs64
Copy link

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

@kuceb
Copy link
Contributor

kuceb commented Oct 24, 2019

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

@kuceb kuceb added the type: regression A bug that didn't appear until a specific Cy version release label Oct 24, 2019
@kuceb kuceb self-assigned this Oct 24, 2019
@wKovacs64
Copy link
Author

Great, thanks @bkucera

@cypress-bot cypress-bot bot added stage: work in progress stage: needs review The PR code is done & tested, needs review and removed stage: work in progress stage: needs review The PR code is done & tested, needs review labels Oct 28, 2019
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Oct 29, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 29, 2019

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.

1 similar comment
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 29, 2019

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
Copy link
Contributor

cypress-bot bot commented Nov 5, 2019

Released in 3.6.0.

@jennifer-shehane jennifer-shehane added the v3.5.0 🐛 Issue present since 3.5.0 label Dec 10, 2019
@cypress-io cypress-io locked as resolved and limited conversation to collaborators Dec 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: regression A bug that didn't appear until a specific Cy version release v3.5.0 🐛 Issue present since 3.5.0
Projects
None yet
3 participants