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
Click on table cell inside a contenteditable element does not behave as expected #7721
Comments
@erwinheitzman Thanks for the reproducible example!
<!DOCTYPE html>
<html>
<body>
<div contenteditable="true" style="border: 1px solid black; width: 300px;">
<table style="border: 1px solid black; width: 300px;">
<tr style="border: 1px solid black">
<td style="border: 1px solid black"></td>
<td style="border: 1px solid black"></td>
<td style="border: 1px solid black"></td>
</tr>
</table>
</div>
</body>
</html>
it('should type inside of the table cell', () => {
cy.visit('index.html')
cy.get('td').last()
.type('dummy text')
}) Current behavior What should happen |
Hi @erwinheitzman, looking into this. Since cy.get('[contenteditable] td:first')
.then(($el) => {
const el = $el[0]
const sel = el.ownerDocument.getSelection()
// find and focus the containing div[contenteditable] element (focusing the td node is a no-op)
Cypress.dom.getHostContenteditable(el).focus()
// move the selection into the td element
sel.selectAllChildren(el)
})
.type('foobar') Hope this helps |
The code for this is done in cypress-io/cypress#9066, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
When clicking a table cell, the table cell is not focused / not the active element so that when I type, the text is not put into the table cell but outside of it.
Desired behavior:
When clicking a table cell I expect the table cell to be focused and set as the active element so that when I type text, the table cell will be filled with text.
Create this html file:
Create testcase:
Run the testcase to reproduce the issue.
Versions
os: OSX 10.15.4
browser: Chrome 83.0.4103.106
cypress: 4.8.0
The text was updated successfully, but these errors were encountered: