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
editor.experimentalEditContextEnabled breaks text input in aux editors #229825
changed the title [-]editor.experimentalEditContextEnabled breaks text input in aux editors[/-][+]`editor.experimentalEditContextEnabled` breaks text input in aux editors[/+]on Sep 26, 2024
Hi yes thank you for filing this valuable issue. I am able to reproduce this both on insiders.vscode.dev as well as on desktop. This is a strange issue, the edit context no longer receives text update events in auxilliary windows. I believe this could be a chromium/electron bug, will investigate.
Thanks a lot for opening this issue. I have created a small HTML/JS example which indicates this is likely a chromium bug. To reproduce on this smaller example do the following:
Take the following HTML page:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>
Edit Context With Aux window<br>
1. Open the dev tools right now<br>
2. Type some text in the editor below, no text should appear which is normal because we don't modify the div
with
the EditContext. Be quick before the aux window appears in 10 seconds (you can increase the timeout in the HTML
page). <br>
3. Notice how the text-update AND the keydown listener send events that are logged in the console<br>
4. Wait for 10 seconds for the auxiliary window to appear into which the body of the current window is
appended<br>
5. Open the dev tools on that window<br>
6. Place the windows side-by-side<br>
7. Type into the editor of the aux window<br>
8. Notice that this div is editable whereas before it was not? [bug]<br>
9. Notice that on typing, only the keydown listener in the first window fires, the text-update event does not
fire[bug]<br>
</p>
<div id="html-editor" spellcheck="false" style="border:1px solid black"></div>
<script>
const IS_EDIT_CONTEXT_SUPPORTED = 'EditContext' in window;
console.log('IS_EDIT_CONTEXT_SUPPORTED : ', IS_EDIT_CONTEXT_SUPPORTED);
const editorEl = document.getElementById("html-editor");
editorEl.style.height = '200px';
editorEl.style.width = '100%';
if (IS_EDIT_CONTEXT_SUPPORTED) {
const editContext = new EditContext();
editorEl.editContext = editContext;
editContext.addEventListener("textupdate", e => {
console.log('textupdate : ', e);
});
editorEl.addEventListener('keydown', e => {
console.log('keydown : ', e);
});
setTimeout(() => {
const body = window.document.body;
const newWindow = window.open();
newWindow?.window?.document.body.append(body);
console.log('body : ', body);
console.log('newWindow : ', newWindow);
}, 10000)
}
</script>
</body>
</html>
Open in Chrome
Open the dev tools as soon as the page appears
Type some text in the editor, no text should appear which is normal because we don't modify the div with the EditContext. Be quick before the aux window appears in 10 seconds (you can increase the timeout in the HTML page)
Notice how the text-update AND the keydown listener send events that are logged in the console
Wait for 10 seconds for the auxiliary window to appear into which the body of the current window is appended
Open the dev tools on that aux window
Place the main and the aux window side-by-side
Type into the editor of the aux window
Notice that this div is editable whereas before it was not before 🐛
Notice that on typing, only the keydown listener in the first window fires, the text-update event does not fire 🐛
Screen.Recording.2024-09-27.at.17.10.51.mov
I will create an issue with the chromium team and link it here.
After some discussion with the team, we will work on a workaround, which consists in instantiating the edit context in the newly created window. For that the window ID will have to be passed down into the editor/view constructor.
Activity
[-]editor.experimentalEditContextEnabled breaks text input in aux editors[/-][+]`editor.experimentalEditContextEnabled` breaks text input in aux editors[/+]IllusionMH commentedon Sep 26, 2024
/assign aiday-mar -jrieken
aiday-mar commentedon Sep 26, 2024
Hi yes thank you for filing this valuable issue. I am able to reproduce this both on insiders.vscode.dev as well as on desktop. This is a strange issue, the edit context no longer receives text update events in auxilliary windows. I believe this could be a chromium/electron bug, will investigate.
aiday-mar commentedon Sep 27, 2024
Thanks a lot for opening this issue. I have created a small HTML/JS example which indicates this is likely a chromium bug. To reproduce on this smaller example do the following:
Screen.Recording.2024-09-27.at.17.10.51.mov
I will create an issue with the chromium team and link it here.
cc Robo (@deepak1556) Benjamin Pasero (@bpasero)
aiday-mar commentedon Sep 27, 2024
The upstream chromium issue is this one https://issues.chromium.org/issues/369865060
aiday-mar commentedon Oct 2, 2024
After some discussion with the team, we will work on a workaround, which consists in instantiating the edit context in the newly created window. For that the window ID will have to be passed down into the editor/view constructor.
aiday-mar commentedon Oct 9, 2024
This issue will be closed as a workaround fix has been added.
IllusionMH commentedon Oct 9, 2024
Looks like
"editor.experimentalEditContextEnabled": true,works for me in aux windows now. Unable to repro my previous problems.Thanks!