14

macOS Mojave 10.14.6, Safari 14.0.2 - often only a part of the code is highlighted. After a certain point, the rest of the code won't be highlighted at all. Looks like only the code that fits in the initial code box is highlighted.

Screenshot (notice how only 3/4 of the do{ are highlighted, and highlighting disappears afterwards):

Syntax not highlighted

Post in question: conflicting types and no return.

Highlighting is restored after the window is resized, but breaks again after I reload the page.

6
  • 4
    It looks as expected on pageload in Chrome and FF on W10 Dec 27, 2020 at 21:45
  • Also no-repro on Chrome 87.0.4280.101 on Android 10 on both the full (responsive) site and mobile (unmaintained) site.
    – Wai Ha Lee
    Dec 27, 2020 at 22:44
  • Do you have any plugins, etc. enabled on your browser?
    – Wai Ha Lee
    Dec 27, 2020 at 22:47
  • Just got on a Mac, displays normally on Safari 13.1.2, on Catalina Dec 27, 2020 at 23:24
  • 1
    I've seen similar before on Safari on ipad though at the moment that Q looks fine to me Dec 27, 2020 at 23:48
  • No repro in Firefox 84.0.1 (64-bit) on Linux Dec 27, 2020 at 23:57

1 Answer 1

15

I can repro here on Safari 14.0.2 and in STP 14.1 (BigSur).

The colors stop where the overflown area starts, this is definitively a Safari bug, you should report it to them. Unfortunately I wasn't able to produce a minimal repro case...

But I'm not sure SE should do anything about this. Whatever workaround will make either the code base more complex for something the browser will hopefully fix, or it will make other browsers slower for nothing.

In the mean time, it seems a "force-repaint hack" works around this issue, so you could run a user-script which does that:

addEventListener( "scroll", ({target}) => {
  // only if we scrolled in a <pre>
  if( target.matches && target.matches( "pre" ) ) {
    // force full repaint
    target.style.filter = target.style.filter ? "" : "blur(0px)";
  }
}, { capture: true } );
2
  • It's still happening with Safari 15.4 on MacOS Monterey in 2022, so I don't think they'll be fixing it anytime soon May 6, 2022 at 19:53
  • 2
    @QuackE.Duck not if nobody reports it no
    – Kaiido
    May 7, 2022 at 0:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .