Skip to content

6.99.41 — Scribble stays out

Pre-release
Pre-release

Choose a tag to compare

@ppardi ppardi released this 06 Oct 17:56
· 30 commits to 6.1.x since this release

Scribble stays out, even after the pen has been somewhere else.

What was wrong

Move the pen into the browser's own address bar, then back down onto the
canvas, and from that moment the handwriting stopped being ink: iPadOS
recognised it and put the text into the note underneath.

The dialog's whole defence against Scribble is holding the focus. Nothing
inside it is a text field, so while the focus is in there a recogniser has
nothing to write into. That focus was claimed once, when the dialog opened,
and again only if the dialog was resized — so it lasted exactly until
something took it away.

The address bar is browser chrome. It is outside the page altogether, so
nothing fires on the document when the pen goes there, and on the way back
WebKit hands the focus wherever it likes. That leaves the note's editor as the
nearest text field, sitting live behind the canvas.

The fix

Two halves, because holding the focus is a race this dialog can lose.

  • The focus is taken back whenever it lands outside — on focusin, and on
    the window getting the focus back. The window is the one that matters here,
    since the document hears nothing while the pen is in the browser's chrome.
    A colour or tool menu that is open is still left alone: each is a popover,
    teleported out of the dialog, and taking the focus back would shut it
    mid-choice.

  • What the dialog covers is made inert while it is open — which removes
    what a recogniser would write into rather than racing it for the focus. The
    editor is handed back before the focus is, because focusing an inert element
    does nothing at all and the note would be left without a caret. An inert
    that was already there is left alone, and the element put out of reach is
    remembered rather than looked up again, since the editor is replaced when a
    note is reloaded.

Worth knowing

If Scribble has already engaged before the pen comes back, there is now
nothing behind the canvas to write into — but iPadOS may still withhold the
pen from the canvas for that stroke. Ink that simply does not register, rather
than turning into text in the note, is that case: the second half working and
the first not being enough.

Nothing about the file format changes and nothing already drawn is altered.