Found a fix for the unwanted blinking caret in Internet Explorer browsers (IE9 through IE11, the last version of IE)

This commit is contained in:
Jeff 2017-07-21 11:34:25 -07:00 committed by Jeff Parsons
commit b7e424a46c
14 changed files with 1282 additions and 1248 deletions

View file

@ -350,6 +350,11 @@ class Computer extends Component {
if (video) {
var control = video.getTextArea();
if (control) {
/*
* By default, the Video textarea overlay has opacity and lineHeight styles set to "0"
* to make the overall textarea and its blinking caret invisible (respectively), so in order
* to use it as a diagnostic display, we must temporarily set both those styles to "1".
*/
control.style.opacity = "1";
control.style.lineHeight = "1";
this.cDiagnosticScreens++;
@ -370,8 +375,20 @@ class Computer extends Component {
if (video) {
var control = video.getTextArea();
if (control) {
var agent = Web.getUserAgent();
/*
* Return the Video textarea overlay's opacity and lineHeight styles to their original values.
*/
control.style.opacity = "0";
control.style.lineHeight = "0";
/*
* Setting lineHeight in IE isn't sufficient to hide the caret; we must also set fontSize to "0",
* and we make the change IE-specific because it can have weird side-effects in other browsers (eg,
* it makes Safari on iOS over-zoom whenever the textarea receives focus). And making it IE-specific
* is, as usual, harder than it should be, because IE11 stopped identifying itself as "MSIE", hence
* the additional "Trident" check.
*/
if (agent.indexOf("MSIE") >= 0 || agent.indexOf("Trident") >= 0) control.style.fontSize = "0";
control.value = "";
}
}

View file

@ -1058,11 +1058,11 @@ class Component {
* Why do we throw an Error only to immediately catch and ignore it? Simply to give
* any IDE the opportunity to inspect the application's state. Even when the IDE has
* control, you should still be able to invoke Debugger commands from the IDE's REPL,
* using the '$' global function that the Debugger constructor defines; eg:
* using the global function that the Debugger constructor defines; eg:
*
* $('r')
* $('dw 0:0')
* $('h')
* pcx86('r')
* pcx86('dw 0:0')
* pcx86('h')
* ...
*
* If you have no desire to stop on assertions, consider this a no-op. However, another

View file

@ -2,7 +2,7 @@
/* @author Jeff Parsons (@jeffpar)
@website http://www.pcjs.org/
@created 2013-05-05
@modified 2014-03-12
@modified 2017-07-21
@license http://www.gnu.org/licenses/gpl.html
*/
@ -217,7 +217,7 @@
font-size: medium;
background: rgba(0, 0, 0, .5);
opacity: 0;
line-height: 0; /* try to prevent Safari on iOS from always displaying a blinking cursor */
line-height: 0; /* try to prevent Safari on iOS from always displaying a blinking caret */
}
.pcjs-reference {
float: left;