Bug 1661054 - Stop the codemirror cursor animation when it's not focused, r=nchevobbe.

The animation should only be set when the editor is focused, otherwise the
animation will continue even when devtools is in a background tab.
This happens because the cursor is hidden using visiblity: hidden rather than
display: none in codemirror.css.

Differential Revision: https://phabricator.services.mozilla.com/D106292
This commit is contained in:
Florian Quèze 2021-02-25 20:25:39 +00:00
Родитель 348505d448
Коммит 4194a74769
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -279,13 +279,19 @@
100% {}
}
.CodeMirror-cursor {
.CodeMirror-focused .CodeMirror-cursor {
/*
* We're using the --caret-blink-time custom property for the animation duration.
* It is set in editor.js when we setup the CodeMirror instance, and will map either
* to the value of the ui.caretBlinkTime preference, or to CodeMirror's default for
* cursorBlinkRate. (See Bug 1609567 for more information on why this is needed).
*/
/*
* The animation should only be set when the editor is focused, otherwise the
* animation will continue even when devtools is in a background tab.
* This happens because the cursor is hidden using visiblity: hidden rather than
* display: none in codemirror.css. See bug 1661054 for details.
*/
animation: cursor-blink calc(var(--caret-blink-time, 0.53s) * 2) steps(1) infinite;
}
@ -296,4 +302,4 @@
*/
.CodeMirror-lines {
text-align: left;
}
}