Skip to content

Typing a modifier key anywhere removes selected text from an input in 3.5.0 #5439

@dwelle

Description

@dwelle

Current behavior:

Typing a modifier key into an input anywhere removes selected text in an active input.

Desired behavior:

Shouldn't touch input value at all.

Steps to reproduce: (app code and test code)

describe('test', () => {
    it('test', () => {
        cy.document().then(doc => {
            doc.body.innerHTML = `
                <textarea class="one">hello</textarea>
                <textarea class="two">hello</textarea>
                <input class="three" value="hello">
            `;
        });

        // (1) clears whole textarea
        cy.get('.one').type('{selectall}').type('{ctrl}');

        // (2) clears whole textarea
        cy.get('.two').type('{selectall}');
        cy.get('body').type('{ctrl}');

        // (3) removes last letter
        cy.get('.three')
            .focus()
            .then( $input => {
                $input[0].selectionStart = 4;
                $input[0].selectionEnd = 5;
            })
            .type('{ctrl}');
    });
});

Versions

  • Cypress 3.5.0, Win 7, chrome stable 77 (headed) & chrome canary 73 (headless)
  • It's possible a regression in older cypress version (I've migrated from 3.3.13.5.0 directly)

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

Development

No branches or pull requests

Issue actions