arnog / mathlive

A web component for easy math input
https://cortexjs.io/mathlive
MIT License
1.56k stars 277 forks source link

Shaky caret on Firefox #1056

Closed stefnotch closed 10 months ago

stefnotch commented 3 years ago

Description

On Firefox, the expression shakes a little bit when moving the caret around.

For what it's worth, one fix is injecting the following styles into mathlive

math-field:hover,
  math-field:focus,
  math-field:focus-within {
    outline: var(--border-color-secondary) auto 1px;
  }
  math-field {
    transition: outline 0.2s ease-in-out;
  }

Steps to Reproduce

  1. Be on Firefox with Windows 10
  2. Go to https://cortexjs.io/mathlive/
  3. Paste in \begin{equation*} \frac{3}{3+5} \end{equation*}
  4. Put the caret at the end of the mathfield
  5. Hit the left arrow key

Actual Behavior

2021-06-27-0166

Expected Behavior

No shaking

Environment

MathLive version v0.69.4

Operating System Windows 10

Browser Firefox

stefnotch commented 3 years ago

A fix for the caret is to use box-shadows

.ML__caret:after {
          border-right-width: 0px !important;
          margin-right: 0px !important;
          width: 0px !important;
          box-shadow: 0px 0px 0px 1px var(--caret,hsl(var(--hue,212),40%,49%));
         }
manstie commented 2 years ago

I do not get this issue with MathLive 0.82 / Windows 10 / Firefox 105.0.1

stefnotch commented 2 years ago

True, the issue seems to be mostly gone now. The only thing I could observe was the letters ever so slightly changing their position depending on where the caret is.

(Tested with mathlive on the website)

firefox_2022-10-02-0263.webm

arnog commented 10 months ago

I think it's fixed now, unless using extremely high zooming level.