Bug 236395

Summary: Clipboard Paste dialog doesn't show on external monitors
Product: WebKit Reporter: Michael Feldstein <msfeldstein>
Component: UI EventsAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: akeerthi, hi, katherine_cheney, megan_gardner, msfeldstein, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Fixes the bug
none
+ Test coverage none

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].