Keep cursor side when a widget decoration is wrapped in a mark decoration

I’ve been using the side property of a widget decoration to ensure that the cursor is drawn before the widget element.

However, if the position is wrapped in a mark decoration (which I do want), the side property of the widget decoration seems to be ignored, and the cursor is drawn after the widget element.

demo

Is this working as expected/is there a way to alter the behaviour so the cursor is always drawn before the widget element?

I’ve found that if I disable the drawSelection extension then the native cursor seems to be positioned on the correct side.

That was not intended behavior. This patch should improve it.