-
Notifications
You must be signed in to change notification settings - Fork 447
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
Can't create cell on Safari when a previous cell is focused #2003
Comments
Seeing this one as well, on basically the same environment. It does not seem to matter how Livebook is started, it occurs when running the app or via mix phx.server. Some data points to hopefully help track this down:
|
Think I've found the reason and a fix, but can't fully understand or explain it. Monaco seems to force the focus back to the TextAreaInput if it loses focus but its content did not change? 🤔 From // If the focus is outside the textarea, browsers will try really hard to reveal the textarea.
// Here, we try to undo the browser's desperate reveal.
try {
const scrollState = dom.saveParentsScrollTop(textArea);
this.setIgnoreSelectionChangeTime('setSelectionRange');
textArea.focus();
textArea.setSelectionRange(selectionStart, selectionEnd);
dom.restoreParentsScrollTop(textArea, scrollState);
}
catch (e) {
// Sometimes IE throws when setting selection (e.g. textarea is off-DOM)
} We only end up in this path, if if (event.target.closest(`[data-el-insert-buttons] button`)) {
this.setInsertMode(false); // <--- added
return;
} |
@awerment thanks for pinpointing the relevant vscode code :) We can't do the workaround you suggested, because it effectively annihilates the Hopefully we can address this upstream, I opened an issue microsoft/monaco-editor#4042 with a possible fix. |
@jonatanklosko Thanks for looking into this and the explanation! So the "fix" would cause the same issue (clicks not registering because of the page shifting) in other cases, I see. |
Environment
1.14.4 / 25
Mac OS Ventura
livebook cli
git rev-parse HEAD
if running with mix):0.9.3
Safari (worked fine in Chrome)
Nothing logged
Nothing logged
Current behavior
If the focus is on a cell not visible anymore, due to scrolling, when clicking on
+ Code
, instead of creating a new cell, it simply goes back to the focused cell and doesn't create a new cell.Here's a recording of the problem:
Screen.Recording.2023-06-22.at.15.16.13.mov
In this video I'm reproducing the error with some empty cells, but I've got this error already a few times in more real notebooks 😅
Expected behavior
Expected to behave the same in Chrome, to create a new cell and refocus on this new cell 💪
Thanks!
The text was updated successfully, but these errors were encountered: