-
-
Notifications
You must be signed in to change notification settings - Fork 124
Description
Summary
When using a stylus (e.g., Surface Pen) on a touchscreen device like the Microsoft Surface, lines are not consistently rendered on the canvas. The pen input is detected (events fire), but strokes fail to appear visually or appear inconsistently.
Affected Package
react-signature-canvas
: ^1.1.0-alpha.2
Internally depends on signature_pad
: ^2.3.2
✅ Issue resolved in signature_pad
>= 5.0.7 (tested with this version)
Device and Environment
- Device: Microsoft Surface
- OS: Windows 11
- Processor: Intel i7-1165G7 @ 2.80GHz
- RAM: 16 GB
- Browser: Chrome, Edge (latest)
- Touch Support: Pen + 10-point multi-touch
Steps to Reproduce
- Use
react-signature-canvas
on a Microsoft Surface or similar device with a stylus. - Draw on the canvas using the pen.
- Observe: pointer events fire (verified via logs), but no lines are drawn, or drawing is inconsistent.
Expected Behavior
Lines should render smoothly and reliably when drawing with a stylus, just like with mouse or finger.
Actual Behavior
- Strokes sometimes do not appear.
- Pointer events are correctly detected.
- Issue specific to pen input with pressure sensitivity.
Cause
The issue originates in [email protected]
, which does not handle pointerType
+ pressure
correctly in certain pen input scenarios. This was fixed in later versions of signature_pad
.
Fix Reference
Older versions of signature_pad
did not handle pen input correctly when PointerEvent.pressure === 0
during the pointerdown
event — a case commonly observed on touchscreen devices like Microsoft Surface. This caused _strokeBegin()
to be skipped, resulting in no lines being drawn.
✅ Recommended Action: Upgrade to [email protected]
or later to ensure correct stylus input behavior across devices.
Suggested Fix
Upgrade react-signature-canvas
to use signature_pad@^5.0.7
instead of ^2.3.2
.
Video
currently: https://github.com/user-attachments/assets/0f5e5685-6fec-471d-9189-e4232b3c4761
with updated to signature_pad@^5.0.7
version: https://github.com/user-attachments/assets/b2a53289-d3f5-4915-a4bc-0fde4d53d27f