Closed Bug 2041292 Opened 5 months ago Closed 5 months ago

Regression: the "Generate OpenPGP Key" wizard buttons are clipped off the bottom of the window on GNOME/Wayland

Categories

(MailNews Core :: Security: OpenPGP, defect)

Thunderbird 151
defect

Tracking

(Not tracked)

RESOLVED FIXED
153 Branch

People

(Reporter: rautyrauty, Assigned: rautyrauty)

References

(Regression)

Details

(Keywords: regression)

Attachments

(7 files, 1 external file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0

Steps to reproduce:

  1. Have at least one mail account (identity) configured.
  2. Open Tools -> OpenPGP Key Manager.
  3. Choose Generate -> New Key Pair.
  4. The "Generate OpenPGP Key" wizard opens as a standalone window.

Tested on ALT Linux with Thunderbird 151.0, under three desktop
environments / compositors.

Regression / root cause

resizeWindow() in
comm/mail/extensions/openpgp/content/ui/keyWizard.js sizes the
standalone wizard window with window.resizeTo(), using the visible
section's clientHeight plus an arbitrary 100 px to account for the
dialog buttons that live in the <dialog> shadow DOM:

window.resizeTo(
  window.outerWidth,
  document.querySelector(`.wizard-section:not([hidden])`).clientHeight + 100
);

This heuristic was introduced by the fix for bug 1922934
(commit 823f2a287ca0), which replaced the earlier
body.scrollHeight + (outerHeight - innerHeight) + 6 computation.

On GNOME/Wayland the result is wrong because window.outerHeight /
window.innerHeight are not settled while the window is still being
mapped. Instrumenting resizeWindow() to log the values across two
consecutive calls gave:

call 1: outerHeight=569 innerHeight=233 sectionClientHeight=497 bodyScrollHeight=1003
call 2: outerHeight=629 innerHeight=540 sectionClientHeight=357 bodyScrollHeight=540

The outerHeight - innerHeight delta jumps from 336 px to 89 px between
the two calls, and the first call sizes the window to an innerHeight
of only 233 px while the visible section alone needs 497 px. Because the
computation never recovers, the buttons stay clipped.

Suggested fix

Replace the manual computation in the non-SubDialog branch of
resizeWindow() with window.sizeToContent(). This lets Gecko measure
the actual content — including the shadow-DOM dialog buttons — and size
the window accounting for the window decorations, independently of the
compositor.

Verified on GNOME 50 / Wayland, KDE Plasma / Wayland and XFCE 4 / X11:
the wizard now opens at the correct size on all three, and is not
oversized on XFCE (the environment of bug 1922934).

See attached patch and before/after screenshots.

Actual results:

On GNOME (Wayland session) the wizard window opens too short: the
"Cancel" and "Generate key" buttons are clipped off the bottom edge of
the window and cannot be reached until the window is manually resized
taller.

Desktop / compositor Result
GNOME 50 / Wayland buttons clipped — broken
KDE Plasma / Wayland OK
XFCE 4 / X11 OK

Expected results:

The wizard window opens tall enough to display all of its content,
including the dialog buttons, on every desktop environment.

Attached image before_xfce.png —
Attached image before_gnome.png —
Attached image before_kde_wayland.png —
Attached image with_fix_gnome.png —
Attached image with_fix_xfce.png —
Keywords: regression
Regressed by: 1922934

(In reply to Magnus Melin [:mkmelin] from comment #7)

Please submit the patch through Phabricator. https://developer.thunderbird.net/thunderbird-development/fixing-a-bug#submitting-a-patch

OK.

resizeWindow() sized the standalone "Generate OpenPGP Key" wizard window
with window.resizeTo(), using the visible section's clientHeight plus an
arbitrary 100px guess for the dialog buttons that live in the <dialog>
shadow DOM.

While the window is still being mapped the outerHeight/innerHeight values
are not settled, so the computed height falls short and the "Cancel" and
"Generate key" buttons are clipped off the bottom of the window on
GNOME/Wayland until the user resizes it by hand.

Use window.sizeToContent() instead, letting Gecko measure the content and
account for the shadow-DOM dialog buttons and the window decorations
consistently across compositors.

This is a regression from the fix for bug 1922934, which replaced the
earlier body.scrollHeight based computation with the clientHeight + 100
heuristic.

Assignee: nobody → rautyrauty
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Target Milestone: --- → 153 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/7f6c9f4eb65b
Size the standalone OpenPGP key wizard window with sizeToContent(). r=Paenglab,mkmelin

Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: