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

Cypress creates a new line (<br> tag) after entering the first letter of a word in text area. #1926

Closed
Pankajshuklaqa opened this issue Jun 11, 2018 · 6 comments · Fixed by #2016
Assignees
Milestone

Comments

@Pankajshuklaqa
Copy link

Pankajshuklaqa commented Jun 11, 2018

Current behavior:

Cypress creates a new line after entering the first letter of a word.
screen shot 2018-06-11 at 4 53 27 pm

Desired behavior:

The code should not create new line and enter letter like "Who"
not like "W
ho"

Steps to reproduce:

Code:-

cy.get("<text area locator>").should('be.visible')
        .type("Who", { force: true })

The above code is creating a new line after entering 'W' letter.

W
ho

Versions

Cypress: 3.1.0
Operating System: MacOS Sierra v10.12.6 (16G1212)
Browser: Chrome v66.0.3359.181 (Official Build) (64-bit)

@jennifer-shehane jennifer-shehane added the stage: needs investigating Someone from Cypress needs to look at this label Jun 11, 2018
@davidzambrana
Copy link

davidzambrana commented Jun 12, 2018

This is also happening to me. The field I type into is

<div aria-describedby="placeholder-rq89" class="notranslate public-DraftEditor-content" contenteditable="true" role="textbox" spellcheck="true" style="outline: none; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><div data-contents="true"><div class="classname" data-block="true" data-editor="rq89" data-offset-key="67lbi-0-0"><div data-offset-key="67lbi-0-0" class="public-classname"><span data-offset-key="67lbi-0-0"><span data-text="true">Text here</span></span></div></div></div></div>

wrongedit

Want to add also that when I save changes after editing these fields it only gets stored the first letter typed -In the example provided above would be 'W'-.

Versions

Cypress: 3.0.1
Operating System: Ubuntu Linux 16.04 LTS
Browser: Electron

@kuceb
Copy link
Contributor

kuceb commented Jun 13, 2018

may be related to issue in progress #1932

@kuceb
Copy link
Contributor

kuceb commented Jun 13, 2018

@Pankajshuklaqa why are you using {force: true} ? Cypress should not have to force a type into an element with contenteditable.
Also, does a <br> show up if you manually type enter in the field?
And what event listeners are on the element? keyup for example ?

@Pankajshuklaqa
Copy link
Author

@bkucera will try to remove {force: true}
Yes, <br> show up when manually type enter in the field.

here are the event listeners on the element:-

screen shot 2018-06-18 at 11 57 27 pm

@kuceb kuceb self-assigned this Jun 28, 2018
@kuceb kuceb added this to the 3.0.3 milestone Jun 29, 2018
@kuceb
Copy link
Contributor

kuceb commented Jun 29, 2018

I've got the fix for this coming up in a patch release. Still working on related issues before submitting a PR

@jennifer-shehane jennifer-shehane added stage: in progress type: bug and removed stage: needs investigating Someone from Cypress needs to look at this labels Jul 12, 2018
brian-mann pushed a commit that referenced this issue Jul 23, 2018
this grew to a large PR fixing many cy.type issues.

fix #365
fix #420
fix #586 
fix #593 
fix #596 
fix #610 
fix #651
fix #940
fix #1002 
fix #1108
fix #1171
fix #1209 
fix #1234 
fix #1366
fix #1381 
fix #1684 
fix #1686
fix #1926 
fix #2056
fix #2096 
fix #2110 
fix #2173
fix #2187
@jennifer-shehane jennifer-shehane added stage: pending release and removed stage: needs review The PR code is done & tested, needs review stage: needs investigating Someone from Cypress needs to look at this stage: in progress labels Jul 23, 2018
@Pankajshuklaqa
Copy link
Author

Thank you @brian-mann :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants