Problem/Motivation

There is currently a bug with the Signature Field widget where the value gets
cleared when the screen is resized.

This is problematic anytime someone wants to resize the browser or if they
rotate a mobile device.

Steps to reproduce

  1. Go to an entity form which contains a Signature field.
  2. Draw anything in the Signature field.
  3. Resize the browser.

Proposed resolution

Instead of clearing the Signature when the browser is resized, re-build the Signature value.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mdolnik created an issue. See original summary.

mdolnik’s picture

mdolnik’s picture

Status: Active » Needs review
Matthijs’s picture

FileSize
1.2 KB

Thanks for reporting. This isn't a bug, but a requirement do deal with HiDPI screens, see https://github.com/szimek/signature_pad#handling-high-dpi-screens

But your changes are mentioned as a workaround, so this should work... I did update the patch a bit, could you please give it a try?
I also removed the valueElement.val(value); call, not sure why I added it in the first place, but it looks redundant.

mdolnik’s picture

Thanks for reporting. This isn't a bug, but a requirement do deal with HiDPI screens

I figured it wasn't a necessarily a bug, but wasn't sure what the reasoning was, thanks for the link. Regardless from the user point of view having their signature disappear would appear as a bug to them.

But your changes are mentioned as a workaround, so this should work... I did update the patch a bit, could you please give it a try?

Your changes seem to work fine on my end, no issue with the changes.

  • Matthijs committed 2eb9325 on 1.x
    Issue #3292082 by mdolnik, Matthijs: Fix signature being cleared on...
Matthijs’s picture

Version: 1.0.1 » 1.x-dev
Status: Needs review » Fixed

Patch applied and committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.