Menu β–Ύ β–΄

#273 fix: keep compact Messenger popovers out of media viewer mode

closed
nobody
None
2026-10-05
2026-09-06
Anonymous
No

Originally created by: kristofferR

Compact Messenger dialogs can trigger media-viewer chrome, restoring the Facebook header and shifting controls when a picker opens.

Classify viewport-sized media overlays structurally and share the resulting marker between CSS and control positioning. Exclude compact/nested pickers, Messenger's main surface, and Carrier overlays; clear stale markers and offsets when viewers hide, change, or disappear.

Validation: rebased onto current main; formatting, Clippy, 246 Rust tests, lint, typechecking, 465 Bun tests, and regenerated inject bundles pass. Chromium fixtures cover three window widths, light/dark themes, both zoom paths from 30–200%, and viewer lifecycle changes. Live Messenger and cross-platform WebView checks remain pending. Local CodeRabbit preflight was skipped by crq due to the shared quota block.

Ref [#254].

Summary by CodeRabbit

  • New Features
  • Improved handling of multiple media viewers, including accurate detection of full-screen image and video viewers.
  • Preserved control positioning, headers, banners, and focus behavior as viewers open, close, resize, or change media.
  • Excluded nested dialogs, navigation areas, composers, and other non-viewer surfaces from viewer controls.

  • Bug Fixes

  • Fixed stale viewer controls and offsets after dialogs disappear or media content changes.
  • Improved behavior across zoom levels, themes, hidden elements, and varying screen sizes.

  • Tests

  • Added browser and classification coverage for media viewer detection and control behavior.

Related

Tickets: #254
Tickets: #264

Discussion

  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: kristofferR

    @codex review for consequential defects introduced by this PR; do not expand its original scope with unrelated refactors, features, or speculative hardening

     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: chatgpt-codex-connector[bot]

    Codex Review Summary

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

    Review Status Commit Review trigger
    πŸ“ Code Review βœ… Completed <relative-time datetime="2026-09-06T18:22:40.749727Z">2026-09-06T18:22:40.749727Z</relative-time> 37eeaf6 Manual request
    ℹ️ About Codex in GitHub
    [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). 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.
     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: coderabbitai[bot]

    ⚠️ Action not completed Review rate limited. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: coderabbitai[bot]

    Review Change Stack

    πŸ“ Walkthrough ## Walkthrough The change adds media viewer classification, supports multiple active dialogs, synchronizes control offsets and attributes, updates CSS selectors, and adds unit and Chromium-based fixture tests across viewport sizes and viewer states. ### Changes **Media viewer controls** |Layer / File(s)|Summary| |---|---| |**Media viewer classification**
    `inject/src/messenger/lib/media-viewer.ts`, `inject/src/messenger/lib/media-viewer.test.ts`|Adds media viewer shape validation and dialog classification based on visibility, viewport coverage, overlay positioning, media content, controls, and excluded regions.| |**Viewer control synchronization and styling**
    `inject/src/messenger/features/viewer-controls.ts`, `src-tauri/inject/messenger.js`, `src-tauri/inject/messenger.css`, `inject/src/messenger/lib/media-viewer.browser.test.ts`|Tracks multiple dialogs, updates viewer markers and control offsets, observes relevant layout and media changes, applies marker-based CSS rules, and validates DOM/CSS behavior in Chromium fixtures.| **Estimated code review effort:** 4 (Complex) | ~45 minutes **Merge Risk:** _🟑 Moderate_ · up to `e8a12` The Messenger fix appears well tested, but the new Chromium fixture can time out and fail CI. Set the test timeout to 60 seconds before merging. ### Sequence Diagram(s) :::mermaid sequenceDiagram participant Dialogs participant MediaViewerDetector participant ViewerControls participant MessengerCSS Dialogs->>MediaViewerDetector: inspect role-based dialogs MediaViewerDetector->>ViewerControls: return media viewer classification ViewerControls->>Dialogs: set or remove data-carrier-media-viewer ViewerControls->>MessengerCSS: apply viewer banner and control rules Dialogs->>ViewerControls: report resize, mutation, load, or metadata changes
    πŸš₯ Pre-merge checks | βœ… 4 | ❌ 1 ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 5 files. (1 skipped: … | Write docstrings for the functions missing them to satisfy the coverage threshold. |
    βœ… Passed checks (4 passed) | Check name | Status | Explanation | | :------------------------: | :------- | :--------------------------------------------------------------------------------------------------------------------------------------- | | Description Check | βœ… Passed | Check skipped - CodeRabbit’s high-level summary is enabled. | | Title check | βœ… Passed | The title clearly and concisely describes the main change: preventing compact Messenger popovers from being classified as media viewers. | | Linked Issues check | βœ… Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | βœ… Passed | Check skipped because no linked issues were found for this pull request. |
    Full details: Docstring Coverage **Explanation** Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 5 files. (1 skipped: 1 unsupported.)
    • [ ] Fix all pre-merge checks with AI
    ✨ Finishing Touches πŸ’‘ 2
    πŸ“ Generate docstrings πŸ’‘ - [ ] Create stacked PR - [ ] Commit on current branch
    πŸ› οΈ Fix failing CI checks πŸ’‘ - [ ] Create stacked PR - [ ] Commit on current branch
    πŸ§ͺ Generate unit tests (beta) - [ ] Create PR with unit tests - [ ] Commit unit tests in branch `fix/254-media-viewer-classification`

    Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

    ❀️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

    Comment @coderabbitai help to get the list of available commands.

     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: chatgpt-codex-connector[bot]

    Codex Review: Didn't find any major issues. Breezy!

    Reviewed commit: e8a1214fbb

    ℹ️ About Codex in GitHub
    [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). 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".
     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: kristofferR

    @coderabbitai review

     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: coderabbitai[bot]

    βœ… Action performed Review finished. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: kristofferR

    @codex review for consequential defects introduced by this PR; do not expand its original scope with unrelated refactors, features, or speculative hardening

     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: kristofferR

    @codex review for consequential defects introduced by this PR; do not expand its original scope with unrelated refactors, features, or speculative hardening

     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: chatgpt-codex-connector[bot]

    Codex Review: Didn't find any major issues. Keep it up!

    Reviewed commit: 74464a4d1e

    ℹ️ About Codex in GitHub
    [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). 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".
     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: kristofferR

    @codex review for consequential defects introduced by this PR; do not expand its original scope with unrelated refactors, features, or speculative hardening

     
  • Anonymous

    Anonymous - 2026-09-06

    Ticket changed by: kristofferR

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2026-09-06

    Originally posted by: chatgpt-codex-connector[bot]

    Codex Review: Didn't find any major issues. πŸš€

    Reviewed commit: 37eeaf6a67

    ℹ️ About Codex in GitHub
    [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). 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".
     

Log in to post a comment.