You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Control+Shift+ArrowLeft fails on contenteditables with FF + Linux #5929
const{chromium, webkit, firefox}=require('playwright');(async()=>{constbrowser=awaitchromium.launch();// ...// locate <div contenteditable="true" id="contenteditable"></div>awaitpage.focus('#contenteditable');awaitpage.keyboard.type('Hello world');awaitpage.keyboard.down('Control');awaitpage.keyboard.down('Shift');awaitpage.keyboard.press('ArrowLeft');awaitpage.keyboard.up('Shift');awaitpage.keyboard.up('Control');// Expectation is that the word "world" should be selected.})();
Describe the bug
This was a strange issue for us. We encountered it on our CI that runs Linux and after playing around, we were able to determine that this only occurs for Firefox on Linux. Specifically, it also only seems to affect contenteditable="true" nodes. It works fine for <input> elements.
It seems that this does nothing in FF for Linux. The expected behavior is to select the word "world", as the keyboard shortcut Control + Shift + ArrowLeft is intended to do (works fine natively using Linux and contenteditables with FF).
Note: when we run this test, we are also running the same test on other browsers too. Could it be that there's a foreground issue with selection and FF?
I'm fairly certain something is going wrong here. I've stripped back the test case so we aren't running any JS and the page is just an empty document with a contenteditable div. I also noticed that this works locally for me using Ubuntu and FF, it just doesn't seem to work when run in a virtualized environment, like Github Actions.
it(`Can select and delete a word`,async()=>{const{page}=e2e;awaitpage.focus('#contenteditable');awaitpage.keyboard.type('Hello world');awaitpage.keyboard.down('Control');awaitpage.keyboard.down('Shift');awaitpage.keyboard.press('ArrowLeft');awaitpage.keyboard.up('Shift');awaitpage.keyboard.up('Control');// Log screenshotawaitpage.keyboard.press('Backspace');constremainingText=awaitpage.textContent('#contenteditable',);expect(remainingText).toBe('Hello ');});
The screenshot just before backspace in Linux + FF on CI:
I can repro it on 1.9.2 but not on tip of tree. Looks like it was fixed via the latest firefox roll. v1.10 should be coming shortly with the fix. Or you can install npm install playwright@next if you are impatient.
Joel Einbinder (@JoelEinbinder) Yep, we use a function that detects platform and uses the right key. What's strange is that if I run in head mode and insert a debugger in the keydown listener on ArrowLeft, the selection then gets applied. Seems like there's maybe a timing or sequencing issue at play? If I switch back to 1.9.2, the same test passes on my Mac locally but fails on CI. :/
Activity
JoelEinbinder commentedon Mar 24, 2021
Added a test that passes for me on firefox/linux. Maybe there is something mores specific happening with your contenteditable div?
trueadm commentedon Mar 24, 2021
Joel Einbinder (@JoelEinbinder) Interesting. I'll dig more into it today. I suspect it's a foreground problem maybe on the CI machine.
trueadm commentedon Mar 24, 2021
I'm fairly certain something is going wrong here. I've stripped back the test case so we aren't running any JS and the page is just an empty document with a contenteditable div. I also noticed that this works locally for me using Ubuntu and FF, it just doesn't seem to work when run in a virtualized environment, like Github Actions.
This is the HTML:
This is the test case:
The screenshot just before backspace in Linux + FF on CI:
Here's out Github Actions config:
trueadm commentedon Mar 24, 2021
Interestingly, if I change the test case to be:
It works fine on FF+Linux on CI. So it does seem like a bug with Playwright.
JoelEinbinder commentedon Mar 24, 2021
I can repro it on 1.9.2 but not on tip of tree. Looks like it was fixed via the latest firefox roll. v1.10 should be coming shortly with the fix. Or you can install npm install playwright@next if you are impatient.
trueadm commentedon Mar 24, 2021
Joel Einbinder (@JoelEinbinder) Awesome! Thanks :)
trueadm commentedon Mar 24, 2021
This is so strange. With playwright@next, FF now passes for Linux on CI but fails when run locally on my Mac.
JoelEinbinder commentedon Mar 24, 2021
trueadm commentedon Mar 24, 2021
Joel Einbinder (@JoelEinbinder) Yep, we use a function that detects platform and uses the right key. What's strange is that if I run in head mode and insert a debugger in the keydown listener on
ArrowLeft, the selection then gets applied. Seems like there's maybe a timing or sequencing issue at play? If I switch back to 1.9.2, the same test passes on my Mac locally but fails on CI. :/feat(firefox): roll Firefox to r1244
feat(firefox): roll Firefox to r1244 (#6052)
JoelEinbinder commentedon Apr 5, 2021
Fixed via #6052 verified via #6034