Pointerup event isn't working correctly with Windows Phone 8.1 / IE11 - windows-phone

The pointerup event is not working correctly with Win Windows Phone 8.1 and Internet Explorer 11. I mean, it is triggered automatically (just after pointerdown), and not when your finger goes out.
I've done an example here.
If you test it with desktop browsers or Android-Chrome or iOS-Chrome/Safai works correctly
Has anyone any workaround about it?

Are you getting a pointercancel event?
If you don't set the touch-action correctly, then pointercancel gets sent through immediately after pointerdown. I think this is because the browser thinks a manipulation such as scrolling has been initiated.
To avoid this we use:
html.is-pointer-events .touch-grip {
-ms-touch-action: none;
touch-action: none;
}
Note that we activate this rule only if we are using Microsoft pointer events, because otherwise the touch-action property interferes with other browsers (e.g. Chrome).
We add is-pointer-events to document.documentElement.className if navigator.msPointerEnabled is true (i.e. we add the class when we are using onpointerdown instead of ontouchstart). If you are using modernizr.js then it looks like it provides a pointerevents class you can use.
Unless you have a compelling need for them and you can afford to invest a lot into it, I would strongly recommend against supporting Microsoft pointer events. For us they have been an expensive headache for us to support, and the value returned has been minimal for us.

Related

Chromium; how to get rid of the black circular X button in fullscreen mode?

In Chromium version 72.0.3626.121 the button to leave the fullscreen mode could be disabled by using the enable-experimental-fullscreen-exit-ui flag. In version 86.0.4240.193, this flag is no longer available.
Does somebody know how to disable this button?
I'm using the following options to start Chromium.
"chrome.exe" --no-default-browser-check --DisableSplashScreen=true --disable-infobars --overscroll-history-navigation=0 --js-flags="--expose-gc" --incognito --start-fullscreen
Adding the --kiosk option disables the button, but it also changes the behavior of the browser, which I don't want.
Appologisied if I'm wrong, and I do not propose this as a proper answer to your question, but this is what I think.
It might be possible that the only way to achieve what you want is to rebuild the browser from the source. For example, I wanted my bookmark UI to show a list bigger than few last items, was thinking this could be tweaked by a plugin or config, but it turns out it's a hardcoded const variable in the source code. An extension could use a different bookmarker to replace the bundled one. However, nothing can change that const value except changing it in the code and recompiling the browser.
Without knowing much internals it feels to me the X is there on purpose as safety, not to allow somebody to take advantage of less tech-savvy users (imagine a Windows login screen made in HTML to steal users credentials). Therefore I think very likely you will not be able to do what you want easily. A lot of the experiments and features get removed from the browser, remember the vertical-tabs were there for few versions as a hidden command-line argument, but then that got removed too.

Capybara Selenium Navigate To URL Hangs With Popup Alert on Safari

At the end of my tests Capybara automatically navigates to "about:blank" in order to set up the next test. Sometimes the application I'm testing will throw a popup alert if the user leaves the page (which is expected). I have some code to handle this:
begin
page.driver.browser.navigate.to("about:blank")
page.driver.browser.switch_to.alert.accept
rescue Selenium::WebDriver::Error::NoAlertPresentError
# No alert was present. Don't need to do anything
end
This works fine on Firefox, Chrome, and IE. But for some reason on Safari the navigate command hangs, I assume because of the popup. Anyone know a workaround for this?
There is no simple workaround for this at this time in any version of Selenium language bindings. It is a known issue the Selenium team is not interested in resolving. Fundamentally, it is due to the architecture of Safari and consequently the architecture of the Safari Driver.
The JavaScript of the Safari Driver extension does not know about most of the alerts and popups and dialogs that appear as modal Cocoa layer windows.
It also cannot interact with them.
There is a way but it won't be easy and nobody's done it.
You would need to use Cocoa.
So you would want to use RubyCocoa in this case.
(or PyObjC if you used Python)
You would then possibly also want a sidecar app actually written in Objective-C.
The trick would be to use the AX (Accessibility API) and a separate process to observe if there is an alert as the front window and poke at its labels and buttons' text as visible to the AX APIs.
AX APIs are probably exposed in RubyCocoa via the ScriptingBridge.
However, you would need to add your 'app' to the Security preference pane's list of things allowed to control the computer.
With that, you could detect the window and handle it.
It could be fairly brittle across web sites, but if built well, you could handle expected conditions.
You could try to confirm like this which I believe should work across browsers
# click ok to confirm
page.evaluate_script('window.confirm = function() { return true; }')

Identify the monitor with the browser window in FireBreath

I am using FireBreath to create a cross browser plugin which makes use of some native libraries for the respective platform (some .NET based DLLs for Windows and Objective-C based dylibs/frameworks for Mac). Native libraries display UI screens. In order to improve usability, if the user has a multi/extended monitor setup, i would like the native UIs to appear on the same screen as the browser window is currently on.
If an identifier to the monitor with the browser window can be retrieved, that can be passed down to the native components which can be configured to display their UIs on that monitor. I have used FireBreath's getWindowPosition() method to get the rect coordinates of the plugin and used that info to identify the correct monitor in the Windows platform.
However, the coordinates returned in Mac seems to be always 0 (or 1) irrespective of monitor on which the browser window currently resides. I understand that we have to configure an event model and a drawing model in order for this to work in Mac. I have tried following event/drawing model combinations without much success.
1) Cocoa/CoreGraphics
2) Carbon/CoreGraphics
Any help in this regard is much appreciated. Also please do share if there are other approaches to achieve the same. What i want to achieve is to identify the monitor on which the current active browser window resides in Mac. I am unsure at this point, but it maybe possible to achieve this at Objective-C level (without any changes at FireBreath level). Also please note that i want to support Safari, Firefox and Chrome browsers.
You won't like this answer, but simply put you can't do that on Mac. The problem is that with CoreGraphics you are only given a CGContextRef to work with, and it doesn't know where it will be drawn. It was technically possible in older browsers to get an NSWindow by exploiting some internal implementation details, but many browsers that's no longer possible and it was never supported.
Other drawing models are the same; CoreAnimation you have a CALayer but it doesn't know which screen or monitor it is drawn to. I personally think it's a bit annoying as well, but I do not know of any way to find out which monitor your plugin is rendered to, particularly since most of them actually copy the buffer to something else and render in a different process.
I did manage to come up with a workaround and i am just replying here for the completeness of the thread. As #taxilian explained, it is not possible to retrieve plugin coordinates using the window reference. As an alternative approach, Javascript 'Window' object has 2 properties called 'screenX' and 'screenY' that return X and Y coordinates of the browser window relative to the screen. If the user has an extended monitor setup, these are the absolute coordinates with respect to the full extended screen. We can use these values to determine the monitor with the browser window (if the X coordinate is outside the bounds of the primary monitor's width, then the browser should essentially be on the extended monitor). We can retrieve DOM properties from Firebreath as explained in the following link:
http://www.firebreath.org/display/documentation/Invoking+methods+on+the+DOM

How to intercept didStartLoad in web view (metro apps)

I have been developing iOS and Mac OSX apps since years. So, I was pretty surprised to find no method for Windows 8 Metro WebView to intercept when it starts loading a new page, but only when it finishes loading.
Is there really any workaround for this? I could not find anything both in the docs and on the web...
Thank you very much!
Fabio
You can use the Window.External.Notify() method to trigger an event back in your C# or whatnot. You can also use the Webview.InvokeScript() to activate scripts from outside the control. You can write a script as a string outside the WebView and use the WebView.InvokeScript() with "eval" as the first arg to run that script inside the control.
ScriptNotify
This shows how to use both ScriptNotify and InvokeScript

Force WinRT app to snapped view

For one of my apps I'd like to send the app to snapped view after tapping a button. As far as I know there's no public API available to send a running application to snapped view. Did anyone find a workaround to do this?
Somehow it should be possible since you're able to do it in Windows 8 itself, and snap one of the running apps.
Update: Being able to trigger a Win+. might do the same trick, but the SendKeys API isn't available in WinRT either.
There is no way to force an application into snapped mode - it has to be a user initiated action.
An application can request to be unsnapped through:
Windows.UI.ViewManagement.ApplicationView.TryUnsnap();
Which tries to push the app into fill mode.
Windows 10 has a ApplicationView.TryResizeView method
So... to summarize the interesting WinRT journey:
Windows 8
Has a a 'Snapped' mode that a only a user can initiate. the developer can try to unsnap with the TryUnsnap method
Windows 8.1
Does not have Snapped mode, and TryUnsnap is deprecated. The dev can still listen for window size changes and know if the app view is in a smaller size as before.
Windows 10
Introduced the ApplicationView.TryResizeView method, where the dev can try to resize. Window size changed event is still there.
ApplicationView.GetForCurrentView().TryResizeView(new size(width, height)));