NEW228274
navigator.clipboard.read is not working context menu
https://bugs.webkit.org/show_bug.cgi?id=228274
Summary navigator.clipboard.read is not working context menu
Vishnu
Reported 2021-07-25 22:19:35 PDT
When we listen on context menu event and tried to access navigator clipboard using navigator.clipboard.read, it is not working and throwing an error NotAllowed permission. This is needed to disable and enable context menu. 1. Open https://codepen.io/rohinikumar4073/pen/OJmzxKo?editors=1011 2. Try to right click any where and observer error in the console.
Attachments
Sam Sneddon [:gsnedders]
Comment 1 2021-07-26 04:34:36 PDT
Are we not treating right-click as a user gesture?
Wenson Hsieh
Comment 2 2021-07-26 07:38:52 PDT
I'm guessing what's happening here is that right click presents a context menu on macOS, which causes the context menu we present for granting programmatic paste access (i.e. a menu with a single Paste menu item in it) to dismiss immediately. This results in the promise being rejected right away :/ We probably need both to coexist somehow.
Sam Sneddon [:gsnedders]
Comment 3 2021-07-26 14:54:08 PDT
(In reply to Wenson Hsieh from comment #2) > I'm guessing what's happening here is that right click presents a context > menu on macOS, which causes the context menu we present for granting > programmatic paste access (i.e. a menu with a single Paste menu item in it) > to dismiss immediately. This results in the promise being rejected right > away :/ > > We probably need both to coexist somehow. Ah, so this is specific to pasting, and won't affect other places where we require a trusted user gesture?
Wenson Hsieh
Comment 4 2021-07-26 14:59:47 PDT
(In reply to Sam Sneddon [:gsnedders] from comment #3) > (In reply to Wenson Hsieh from comment #2) > > I'm guessing what's happening here is that right click presents a context > > menu on macOS, which causes the context menu we present for granting > > programmatic paste access (i.e. a menu with a single Paste menu item in it) > > to dismiss immediately. This results in the promise being rejected right > > away :/ > > > > We probably need both to coexist somehow. > > Ah, so this is specific to pasting, and won't affect other places where we > require a trusted user gesture? Correct (we create the user gesture token underneath this stack trace when right clicking): ``` 1 0x114a5be6f WebCore::UserGestureToken::UserGestureToken(WebCore::ProcessingUserGestureState, WebCore::UserGestureType, WebCore::Document*) 2 0x114a5c449 WebCore::UserGestureIndicator::UserGestureIndicator(std::__1::optional<WebCore::ProcessingUserGestureState>, WebCore::Document*, WebCore::UserGestureType, WebCore::UserGestureIndicator::ProcessInteractionStyle) 3 0x114f6f4a9 WebCore::EventHandler::handleMousePressEvent(WebCore::PlatformMouseEvent const&) 4 0x1154e6ee6 WebCore::UserInputBridge::handleMousePressEvent(WebCore::PlatformMouseEvent const&, WebCore::InputSource) 5 0x10d51657a WebKit::WebPage::mouseEvent(WebKit::WebMouseEvent const&, std::__1::optional<WebKit::SandboxExtension::HandleArray>&&) 6 0x10d532e78 WebKit::WebPage::didReceiveWebPageMessage(IPC::Connection&, IPC::Decoder&) 7 0x10ce43cce IPC::MessageReceiverMap::dispatchMessage(IPC::Connection&, IPC::Decoder&) 8 0x10d357dec WebKit::WebProcess::didReceiveMessage(IPC::Connection&, IPC::Decoder&) 9 0x10ce26204 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::Decoder, std::__1::default_delete<IPC::Decoder> >) 10 0x10ce26445 IPC::Connection::dispatchOneIncomingMessage() ```
Radar WebKit Bug Importer
Comment 5 2021-08-01 22:20:17 PDT
Note You need to log in before you can comment on or make changes to this bug.