Bug 236395 - Clipboard Paste dialog doesn't show on external monitors
Summary: Clipboard Paste dialog doesn't show on external monitors
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-09 12:02 PST by Michael Feldstein
Modified: 2022-03-01 17:09 PST (History)
8 users (show)

See Also:


Attachments
Fixes the bug (7.56 KB, patch)
2022-03-01 11:39 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff
+ Test coverage (9.16 KB, patch)
2022-03-01 12:16 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Feldstein 2022-02-09 12:02:08 PST
If you use the `navigator.clipboard.read` methods, safari throws up a "Paste" context menu for permission approval, but if you're on an external monitor that context menu doesn't show up so the api is unusable for people with external monitors.  Sometimes it only works on external monitors, and sometimes it only works on built-in display.  I'm not sure what causes the difference.

https://codepen.io/msfeldstein/pen/qBVrOev
Comment 1 Radar WebKit Bug Importer 2022-02-14 19:58:02 PST
<rdar://problem/88943577>
Comment 2 Wenson Hsieh 2022-02-25 13:17:30 PST
I suspect this is due to the way in which we compute the confinement rect when positioning the DOM paste context menu:

```
- (NSRect)confinementRectForMenu:(NSMenu *)menu onScreen:(NSScreen *)screen
{
    auto confinementRect = WebCore::enclosingIntRect(NSRect { NSEvent.mouseLocation, menu.size });
    confinementRect.move(0, -confinementRect.height());
    return confinementRect;
}
```

...will look into this soon.
Comment 3 Wenson Hsieh 2022-03-01 11:39:18 PST Comment hidden (obsolete)
Comment 4 Wenson Hsieh 2022-03-01 12:16:49 PST
Created attachment 453521 [details]
+ Test coverage
Comment 5 Wenson Hsieh 2022-03-01 16:23:19 PST
Comment on attachment 453521 [details]
+ Test coverage

Thanks for the review!
Comment 6 EWS 2022-03-01 17:09:00 PST
Committed r290712 (247959@main): <https://commits.webkit.org/247959@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 453521 [details].