diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index e8755c502..a5928dbaa 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -1108,6 +1108,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { event.target.value, "value" ); + elementData.formattedValue = null; }); element.addEventListener("resetform", event => { diff --git a/test/integration/annotation_spec.js b/test/integration/annotation_spec.js index 8b6617eed..118e1c7f7 100644 --- a/test/integration/annotation_spec.js +++ b/test/integration/annotation_spec.js @@ -151,6 +151,31 @@ describe("Text widget", () => { ); }); }); + + describe("issue16473.pdf", () => { + let pages; + + beforeAll(async () => { + pages = await loadAndWait("issue16473.pdf", "[data-annotation-id='22R']"); + }); + + afterAll(async () => { + await closePages(pages); + }); + + it("must reset a formatted value after a change", async () => { + await Promise.all( + pages.map(async ([browserName, page]) => { + await page.type(getSelector("22R"), "a"); + await page.keyboard.press("Tab"); + await page.waitForTimeout(10); + + const text = await page.$eval(getSelector("22R"), el => el.value); + expect(text).withContext(`In ${browserName}`).toEqual("aHello World"); + }) + ); + }); + }); }); describe("Annotation and storage", () => { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index b1864f846..0422f7d58 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -594,3 +594,4 @@ !multiline.pdf !bug1825002.pdf !issue14755.pdf +!issue16473.pdf diff --git a/test/pdfs/issue16473.pdf b/test/pdfs/issue16473.pdf new file mode 100755 index 000000000..e90a61a02 Binary files /dev/null and b/test/pdfs/issue16473.pdf differ