Skip to content

fix(browser): keep emoji panel on screen with compact chat list - #1035

Open
jhordanleandro wants to merge 2 commits into
rafatosta:mainfrom
jhordanleandro:fix/compact-emoji-panel
Open

jhordanleandro wants to merge 2 commits into
rafatosta:mainfrom
jhordanleandro:fix/compact-emoji-panel

Conversation

@jhordanleandro

Copy link
Copy Markdown

Fixes #1026

Problem

WhatsApp Web positions the emoji/GIF/sticker panel with an inline left that centres it on the composer button, without clamping it to the viewport. With the 85 px compact chat list the panel opened about 117 px off-screen to the left.

Change

Add a rule to the chat list stylesheet in resizable_chat_list.js: in compact mode, div[role="application"]:has([data-testid="expressions-panel"]) gets left: calc(var(--zapzap-chat-list-width, 85px) + 8px) !important, so the panel starts to the right of the chat list. It is the rule proposed in the issue, plus a fallback value in case the width variable is not set. The rule only applies in compact mode, so the normal layout is untouched.

Also adds a changelog entry and a regression test.

Tests

  • New test_compact_mode_keeps_expressions_panel_inside_the_window: fails without the rule (-117 != 93) and passes with it; the panel goes back to its native position when the feature is disabled.
  • Full suite in the Flatpak: the only failures are the 4 failures and 4 errors that already occur on main (dictionary UI, zh_CN catalog, accounts context menu, macOS packaging). check_unused_code, test_documentation_structure and git diff --check pass.

The test uses a simplified DOM, not the real WhatsApp Web, so I have not verified the rule against the live page.

WhatsApp Web centres the emoji, GIF and sticker panel on the composer
button without clamping it to the viewport. With the 85 px compact chat
list the panel opened about 117 px off-screen to the left. In compact
mode, start the panel to the right of the chat list instead.

Tests: new regression test (fails without the CSS rule); full suite run
in the Flatpak with only the failures that already occur on main.

Fixes rafatosta#1026
Copilot AI balanced review requested due to automatic review settings November 15, 2026 17:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T17:57:26.287166Z 41d4aa8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce72b3ae01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

pointer-events: none;
}
:root[${compactAttribute}] div[role="application"]:has([data-testid="expressions-panel"]) {
left: calc(var(${columnWidthProperty}, ${minimumColumnWidth}px) + 8px) !important;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the measured column width when the variable is absent

When the script starts in a narrow window with no saved width, applyColumnWidth() clears --zapzap-chat-list-width, but positionHandle() still marks any measured column under 200px as compact. A native 150px column therefore uses this 85px fallback and places the panel at 93px, inside the chat list and over its rows; use the measured column edge when the variable is absent.

Useful? React with 👍 / 👎.

pointer-events: none;
}
:root[${compactAttribute}] div[role="application"]:has([data-testid="expressions-panel"]) {
left: calc(var(${columnWidthProperty}, ${minimumColumnWidth}px) + 8px) !important;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clamp the expression panel to the WebView width

For a 600px WebView and the 560px panel width modeled by the new test, an 85px compact list makes this position start at 93px, leaving the panel's right edge at 653px—53px beyond the viewport. The change therefore still clips the panel in narrow or resized windows; clamp its position to the available viewport width or reflow it.

Useful? React with 👍 / 👎.

The compact-mode rule read --zapzap-chat-list-width, which is only set
when a custom width is applied. In a narrow window with no saved width
the list can be compact at its native width, so the rule fell back to
85 px and placed the panel over the chat list. Publish the measured
column width on every layout pass and use it instead.

Tests: new regression test with a native 150 px column and no saved
width (fails without the change); full suite run in the Flatpak with
only the failures that already occur on main.
@jhordanleandro

Copy link
Copy Markdown
Author

Thanks for the review. I pushed a fix for the first finding: the rule now uses the measured column width, which is published on every layout pass, instead of --zapzap-chat-list-width. That variable is only set when a custom width is applied, so a compact list at its native width (narrow window, no saved width) fell back to 85 px. The new test covers a native 150 px column with no saved width.

I did not change the second finding (clamping the panel to the viewport width). The panel width is controlled by WhatsApp Web, the 560 px in the test is only an example, and I could not check the real panel's containing block without a logged-in account, so I would rather not add a clamp I cannot verify. The narrow-window clipping is also not what #1026 reports. Happy to look into it separately if you want it handled here.

@jhordanleandro

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 41d4aa8001

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compact chat list (85 px): emoji/GIF/sticker panel opens partly off-screen to the left

2 participants