Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#8206: Handle target=_blank links in MS Edge sidePanel sub-frames #8223

Closed
wants to merge 4 commits into from

Conversation

fregante
Copy link
Contributor

What does this PR do?

Discussion

#7889 added a click listener to the links in Edge in order to intercept and manually open a new popup.

Iframes are not covered by this listener, so each iframe needs its own listener.

In this PR I used the content script to add the listener, because presumably these frames natively receive the content script.

Demo

Untested

Checklist

  • Add jest or playwright tests and/or storybook stories
  • Designate a primary reviewer: @fungairino

if (isMicrosoftEdge() && isMV3()) {
openAllLinksInPopups({
// If they don't have target="_blank", the user wants the navigation to happen in the same tab
onlyTargetBlank: true,
Copy link
Contributor Author

@fregante fregante Apr 11, 2024

Choose a reason for hiding this comment

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

Side note: this doesn't cover frames that use a base tag to have a default target. If necessary, it can be done in a followup PR (easy fix in openAllLinksInPopups:

link.target === "_blank" || document.querySelector('base[target="_blank"]')

Copy link

codecov bot commented Apr 11, 2024

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 73.43%. Comparing base (6d95047) to head (71e91bf).
Report is 31 commits behind head on main.

Files Patch % Lines
src/utils/openAllLinksInPopups.ts 0.00% 12 Missing ⚠️
src/contentScript/contentScript.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8223      +/-   ##
==========================================
- Coverage   73.47%   73.43%   -0.05%     
==========================================
  Files        1334     1351      +17     
  Lines       41259    41373     +114     
  Branches     7686     7715      +29     
==========================================
+ Hits        30316    30383      +67     
- Misses      10943    10990      +47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@twschiller
Copy link
Contributor

Things to double-check:

  • Does this work only with links on the screen on initial page load? Or all links?
  • Coordinate with @mthek10 to test in the AA Copilot iframe

@fregante
Copy link
Contributor Author

  • It should cover all links, it's a single global listener

@fungairino
Copy link
Collaborator

Looks good to me, but I'd recommend manually verifying this change before merging. (PR notes these changes are untested)

@twschiller
Copy link
Contributor

twschiller commented Apr 18, 2024

Looks good to me, but I'd recommend manually verifying this change before merging

@grahamlangford @fungairino you'll need to coordinate on testing

@twschiller twschiller changed the title #8206: Handle target=_blank links in sidePanel sub-frames #8206: Handle target=_blank links in MS Edge sidePanel sub-frames Apr 24, 2024
@twschiller twschiller added this to the 1.8.14 milestone Apr 30, 2024
@twschiller twschiller added the mv3 label May 7, 2024
Copy link

github-actions bot commented May 7, 2024

Playwright test results - MV2

passed  38 passed
flaky  2 flaky
skipped  8 skipped

Details

report  Open report ↗︎
stats  48 tests across 17 suites
duration  10 minutes, 6 seconds
commit  71e91bf

Flaky tests

chromeSetup › auth.setup.ts › authenticate
edge › tests/extensionConsoleActivation.spec.ts › can activate a mod with a database

Skipped tests

chrome › tests/extensionConsoleActivation.spec.ts › can activate a mod with built-in integration
edge › tests/extensionConsoleActivation.spec.ts › can activate a mod with built-in integration
chrome › tests/runtime/sidebarController.spec.ts › sidebar controller › shows focus dialog in top-level frame
edge › tests/runtime/sidebarController.spec.ts › sidebar controller › shows focus dialog in top-level frame
chrome › tests/runtime/sidebarNavigation.spec.ts › sidebar mod panels are persistent during navigation
chrome › tests/runtime/sidebarNavigation.spec.ts › sidebar form and temporary panels are unavailable after navigation
edge › tests/runtime/sidebarNavigation.spec.ts › sidebar mod panels are persistent during navigation
edge › tests/runtime/sidebarNavigation.spec.ts › sidebar form and temporary panels are unavailable after navigation

Copy link

github-actions bot commented May 7, 2024

Playwright test results - MV3

passed  48 passed

Details

report  Open report ↗︎
stats  48 tests across 17 suites
duration  12 minutes, 59 seconds
commit  71e91bf

@grahamlangford grahamlangford deleted the F/bug/edge-iframe-sidebar branch September 17, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working edge MS Edge Chromium support mv3
Development

Successfully merging this pull request may close these issues.

4 participants