Skip to content

Commit bbdabc5

Browse files
committed
For mozilla#11838: trigger fallback bar after user clicks in pdf
1 parent 8fc1126 commit bbdabc5

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

web/app.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ const PDFViewerApplication = {
189189
externalServices: DefaultExternalServices,
190190
_boundEvents: {},
191191
contentDispositionFilename: null,
192+
_hasInteracted: false,
193+
_isAcroFormPresent: false,
192194

193195
// Called once when the document is loaded.
194196
async initialize(appConfig) {
@@ -868,10 +870,16 @@ const PDFViewerApplication = {
868870
PDFJSDev.test("MOZCENTRAL || GENERIC")
869871
) {
870872
// Only trigger the fallback once so we don't spam the user with messages
871-
// for one PDF.
873+
// for one PDF. For forms, it should only be triggered once the user has
874+
// clicked within the PDF.
872875
if (this.fellback) {
873876
return;
874877
}
878+
879+
if (featureId === UNSUPPORTED_FEATURES.forms && !this._hasInteracted) {
880+
return;
881+
}
882+
875883
this.fellback = true;
876884
this.externalServices.fallback(
877885
{
@@ -1317,7 +1325,7 @@ const PDFViewerApplication = {
13171325

13181326
if (info.IsAcroFormPresent) {
13191327
console.warn("Warning: AcroForm/XFA is not supported");
1320-
this.fallback(UNSUPPORTED_FEATURES.forms);
1328+
this._isAcroFormPresent = true;
13211329
}
13221330

13231331
if (
@@ -2473,6 +2481,11 @@ function webViewerWheel(evt) {
24732481
}
24742482

24752483
function webViewerClick(evt) {
2484+
PDFViewerApplication._hasInteracted = true;
2485+
if (PDFViewerApplication._isAcroFormPresent) {
2486+
PDFViewerApplication.fallback(UNSUPPORTED_FEATURES.forms);
2487+
}
2488+
24762489
if (!PDFViewerApplication.secondaryToolbar.isOpen) {
24772490
return;
24782491
}

0 commit comments

Comments
 (0)