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

Cursor becoming invisible except at end of line #2909

Closed
austinbrian opened this issue Oct 9, 2017 · 34 comments · Fixed by #2983
Closed

Cursor becoming invisible except at end of line #2909

austinbrian opened this issue Oct 9, 2017 · 34 comments · Fixed by #2983

Comments

@austinbrian
Copy link

I'm having an issue in which the cursor in Jupyter notebook v5.1.0 (running in a Version 61.0.3163.100 Chrome browser) disappears while I'm typing. The cursor will usually show up at the end of a line, but disappears again when navigating, as you can see in a screen recording. The navigating actually happens, I just can't tell where the cursor is at any given moment, unless it navigates to the end of a line.

This seems like it is likely a CodeMirror issue, but I haven't found an example sufficiently close to debug.

@gnestor
Copy link
Contributor

gnestor commented Oct 13, 2017

I unfortunately can't reproduce with notebook 5.1 and Chrome 61.0.3163.100 😕

Can you reproduce with a different browser? If not, do you have any Chrome extensions installed?

@DrNickBailey
Copy link

DrNickBailey commented Oct 13, 2017

I'm getting this issue frequently on Chrome [Version 61.0.3163.100 (Official Build) (64-bit)]
I'm using the Stylish extension and disabling that seems to bring the cursor back.

image

@gnestor
Copy link
Contributor

gnestor commented Oct 13, 2017

That explains it!

@gnestor gnestor closed this as completed Oct 13, 2017
@rpep
Copy link

rpep commented Oct 18, 2017

I've had the same problem, but I don't use that particular extension, so it seems that other Chrome extensions might interfere with this too in strange ways. Annoyingly, I can't identify what other extension I had that interfered, as after turning them all off, it fixed it, and now after re-enabling them all, the problem appears to be solved, but I'll keep an eye out.

@DrNickBailey
Copy link

DrNickBailey commented Oct 19, 2017 via email

@ian-r-rose
Copy link
Member

We have also seen this problem in recent days with JupyterLab, also with Chrome 61 and MacOS 10.13. Cf. jupyterlab/jupyterlab#3097.

@gnestor
Copy link
Contributor

gnestor commented Oct 19, 2017

@ian-r-rose Does it seem to be related to Chrome extensions?

@austinbrian
Copy link
Author

Just wanted to chime in and say that I wasn't running Stylish, so I downloaded it, and running Jupyter notebook with one of the themes active actually did fix the problem at first, but after opening it again, I'm left with the same lack of a cursor. Disabling Stylish (and other chrome extensions) does not help.

Running jupyter notebook in Safari is perfectly fine though, so this may be a Chrome issue.

@rpep
Copy link

rpep commented Oct 24, 2017

I disabled all Chrome Extensions on my machine, and I'm still getting the same problem after some time, so it seems maybe there's several problems presenting in the same way.

@gnestor gnestor reopened this Oct 24, 2017
@Carreau
Copy link
Member

Carreau commented Oct 24, 2017

I think I have seen similar things with OSX/Chrome on other websites, like piazza.

@gnestor
Copy link
Contributor

gnestor commented Oct 24, 2017

@rpep @austinbrian @DrNickBailey Is it possible that the browser was zoomed in more than 100% when you encountered this? Apparently, this is a known bug on Chrome (1px borders disappearing on zoom). Could you also try to reproduce this in Chrome's Incognito Mode?

@rpep
Copy link

rpep commented Oct 24, 2017

Yep, that seems to be the problem for me. I often work at 80%, and I can reproduce this now by altering the zoom level (doesn't seem to happen predictably though) and then clicking around in a box. Should say I'm on Ubuntu rather than OS X.

Edit: yes, can reproduce in incognito.

@jasongrout
Copy link
Member

I was trying to find the relevant Chrome bug reports. There are search results for "1px border bug Chrome". Here's one fix that's already been merged: https://codereview.chromium.org/1412103005

@sccolbert may know of other references.

@DrNickBailey
Copy link

DrNickBailey commented Oct 24, 2017 via email

@gnestor
Copy link
Contributor

gnestor commented Oct 24, 2017

Great! You can try:

.CodeMirror {
    font-size: 1.2em;
}

This will just increase the font size of CodeMirror editors...

@willingc
Copy link
Member

@gnestor Confirming that the cursor goes away when zooming to various levels below 100% on mac OS 10.12.6 and notebook 5.1.0. There are times when the cursor at the end of the line disappears and the cursor will not appear when clicking in the middle of already typed text.

A couple of screenshots. Let me know if you want me try anything in particular. Heading out but will do the next time that I am able.

screenshot 2017-10-24 09 41 42

screenshot 2017-10-24 09 43 31

P.S. Sorry I was doing this quickly on a notebook with RISE installed. The behavior was not seen before when I had 5.2.0. Not sure if coincidence or related.

@gnestor
Copy link
Contributor

gnestor commented Oct 24, 2017

Thanks @willingc! Let me know if upgrading to notebook 5.2.0 resolves this (I don't think it will, but who knows!).

@blink1073
Copy link
Contributor

I see the cursor disappearance on both 5.1 and 5.2.

@joydeep1701
Copy link

Seems like at certain values of zoom level, more specifically at 80%,67%,50% and sometimes even at 90% the cursor goes invisible. Setting zoom level to 100% brings the cursor back. Python 3.6.0 |Anaconda 4.3.1 (64-bit) Chromium Version 62.0.3202.62 (Official Build , running on Ubuntu 16.04 (64-bit)

@gnestor
Copy link
Contributor

gnestor commented Oct 26, 2017

I was trying to find the relevant Chrome bug reports. There are search results for "1px border bug Chrome". Here's one fix that's already been merged: https://codereview.chromium.org/1412103005

What we can do now (until a Chrome bug fix is released) is change the border style for CodeMirror's cursor from 1px to 2px`:

.CodeMirror-cursor {
    border-left: 2px solid black;
}

That will make the cursor visible at all zoom levels, but it will also make the cursor twice as thick for zoom levels 67% and above.

@blink1073
Copy link
Contributor

If I use 1.2px I get a 1px border between 50 and 110%.

@blink1073
Copy link
Contributor

(no border below 50% and 2px above 110%)

@blink1073
Copy link
Contributor

I see equivalent behavior on Firefox as well with that border width.

@gnestor
Copy link
Contributor

gnestor commented Oct 26, 2017

With 1.2px I'm seeing the cursor until 25%, at which point it's visible on some lines and not on others. Switching to 3px at 25% brings the cursor back, so I was thinking that we could use CSS media queries to set the border conditionally based on viewport width (when zoomed to 25%, the width is ~3500 and when zoomed at 100% it's ~1000).

@blink1073
Copy link
Contributor

I'm not sure there is a deterministic way to detect zoom level in CSS from what I can find on the interwebs.

@gnestor
Copy link
Contributor

gnestor commented Oct 26, 2017

I'm going off of https://stackoverflow.com/a/22247258/2217533

@blink1073
Copy link
Contributor

It looks like you can use that as a proxy, but not all devices have the same base width and you may or may not be full screen.

@gnestor
Copy link
Contributor

gnestor commented Oct 26, 2017

Totally. This works for zoom levels 25%-200%, tested on a 13" MBP Retina:

.CodeMirror-cursor {
    border-left: 1.4px solid black;
}

// When zoomed out 67% and 33%
@media screen and (min-width: 2138px) and (max-width: 4319px)  {
    .CodeMirror-cursor {
        border-left: 2px solid black;
    }
}

// When zoomed out less than 33%
@media screen and (min-width: 4320px)  {
    .CodeMirror-cursor {
        border-left: 4px solid black;
    }
}

@blink1073
Copy link
Contributor

The cutoffs are the same for me on a 15.6" MBP Retina.

@gnestor
Copy link
Contributor

gnestor commented Oct 26, 2017

cutoffs = breakpoints?

@blink1073
Copy link
Contributor

Yep

@louis-red
Copy link

Don't know if related, maybe a separate issue, but I also have a non-visible cursor

  • in Jupyter Lab
  • with Firefox Quantum 58 (could reproduce the issue with Chrome 64)
  • only in the code editor (not in the notebooks)
  • at all levels of zoom

@willingc
Copy link
Member

willingc commented Mar 8, 2018

Hi @JacquotLeHaricot, Thanks for the report. If you would like to follow-up with the JupyterLab development team, there is an open issue jupyterlab/jupyterlab#4104.
cc/ @jasongrout

@minrk minrk added this to the Reference milestone Sep 13, 2018
@parthkhare
Copy link

Silly solution but try enlarging your screen size (Ctrl +), worked for me.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.