Programmatically Focus on on a webview (WKWebView) - swift

I am working on a macOS app in which I am using a WKWebview to show web content.
However, after I clicked on another application and then click on my macOS app, I need to click twice on the Webview window, as it doesn't get activated by hovering my mouse over it.
It doesn't listen to events until I click the webview window.
I'm new to Swift and being used to Javascript I would just add a 'mouseenter' listener to the macOS window to focus the webview.
Does anybody know how to solve this?
Thanks!

Related

How to disable cut-copy-paste pop up in webview on text selection in Flutter

How do I disable the cut-copy-paste pop-up in a web view in Flutter? I want the text selection feature to remain as it is, but I don't want the pop-up to appear. I googled a lot but nothing worked for me.
I am using this Flutter WebView.

Default iphone keyboard does not close for entire application if it is opened in iframe in ionic 3

i have used cordova--plugin-ionic-keyboard default plugin in my hybrid ios
application in ionic 3 .
when i open a payment gateway link by using iframe and i click on the textbox button for writing a card details keyboard will appear but if any case i want to go back after opening a keyboard then keyboard is not closed or hide for whole app then i have to close the app and start again.
i have searched a lot of things on internet but i can not get a appropriate answer which works for me.
i have tried out hide() method of plugin but whichever page i use this hide method that page is not open means app stop before the page on which i try hide method.
i also used in-app browser but still not work

How to open app window on toolbar click in safari app extension?

I'd like to open an application/extension Window when user clicks toolbar item in safari. This is not question about extension's Popover feature. The main reason is to close/hide the window on deactivation AND user action (both conditions are required to work).
Safari App Extension (meaning the new preferred/forced way to create extensions for safari by Apple) can open a Popover or call a Command when toolbar item is clicked. But it cannot be hidden programatically (https://forums.developer.apple.com/thread/105817). Per answer by bweinstein it's work in progress by apple devs.
My use case is about Window containing WKWebView with loaded webpage. When user clicks anything in there I want to open a page in Safari's new tab (this part already works for me in Popover mode) and close the window immediately (this doesn't work for me yet)
So my thinking here was to avoid integrated Popover feature. I'd like to show Window instead when Command (override func toolbarItemClicked(in window: SFSafariWindow) {}) is called.
I know this is somehow doable as e.g. agilebits' 1Password extension is doing exactly this: when you click a toolbar item, window is displayed having no close/minimize buttons, no menu etc. It works exactly as I need, but I don't know how to achieve that.
I don't know whether to define the view as part of Safari extension or as part of Storyboard of containing app and how to access it programatically and show it on screen when user clicks the toolbar item.
As I am new to macos development I don't really have a code to share. Important part from my POV:
- Info.plist's NSExtension->SFSafariToolbarItem->Action is set to Command
As pointed above, feature I need to achieve is to open and close a Window programatically when user clicks toolbar item.
Thanks in advance
Could you not call SFSafarWindow.openTab("httxxx://mysite.com", true, ...) in your toolbarItemClicked
You could also call SFSafariApplication.openWindow API and close SFSafariWindow (by calling windowObject.close() ) -

JavaFxPorts Native Webview

Is it possible for the Android WebView to be implemented in JavaFx rather than the native Webview window that is being currently used because the native window causes lightweight vs heavyweight issues. I have a MenuButton that does not display any of the MenuItems because they are all hidden behind the WebView.
The first image shows the menu being displayed normally on top of a regular node.
The second image shows the menu being hidden behind the android webview.

popover view for a status item not responsive to mouse movements

I have been struggling with this and could not find a solution.
I am creating a statusitem app for mac osx using swift. When the item is clicked a popover with a custom view that has a webview in it appears. everything works fine except that after clicking outside and the popover is closed and clicking again on statusitem to show popover this time the view (webview) is not responsive to mouse movement events like mouse hover a link etc.. unless I click inside the popover to activate it. I found a solution by calling NSApp.activateIgnoringOtherApps(true) but this greys out other opened applications like chrome.
Now my question is that, can I make the app active without greying out other apps? dropbox mac app is an example, clicking the item in status bar, opens the popover of dropbox and its responsive to mouse events but other opened apps in the background are not greyed out and they are responsive to mouse movement events, even after clicking inside it doesn't grey out other apps unless a window appear e.g. preferences window or login window. How to achieve this behaviour?
this image shows how webview is not interactive with mouse
the second image show how it is interactive with mouse hover effect on "Advertising Programs" but chrome app is greyed out