I am facing a strange issue with keyboard event handling. I am able to use keyboard event on my screen for the first event. However, when I try for the second event it fails to execute.
e.g. For zoom, Ctrl+1 works only for the first time. Same happens when I try using some other event after the first one.
Note: It works absolutely fine if I use mouse events for above actions.
I am using
Actions action = actions.sendKeys(Keys.CONTROL, Keys.NUMPAD1);
action.perform();
I don't know how but when i when used "send keys" command two times and "perform "once it started to work.
However, this has happened with few keyboard events. Others work with single usage of send keys.
Actions action = actions.sendKeys(Keys.CONTROL, Keys.NUMPAD1);
Actions action = actions.sendKeys(Keys.CONTROL, Keys.NUMPAD1);
action.perform();
Related
I've got a React app using GTM...
I've got an dataLayer.push({'event': 'linkClicked'});
The first time I click the link, no event is emitted. Any other clicks, and the event is emitted.
I've confirmed via the chorme JS debugger and GA Debugger that
the push code is getting hit every time
the event gets emitted every time but the first time.
I can see the first and any subsequent events appear in the dataLayer. But the GA Debugger only shows the the subsequent events...as does the real time Analytics..
Alternatively...I suppose the event push could be one behind, but that doesn't seem to be the case.
Anybody seen this before?
I use react.js + es6 + webpack to develop my application.
recently, I find if I click a button multiple times in short time, the click handler will trigger multiple times.
I think it's a common case, code snippet like this:
#debounce()
onMidCardClick(url) {
console.count('onMidCardClick trigger times : ');
window.location.href = url;
}
before navigate to the url address, onMidCardClick event handler will triggers multiple times.
So, my way is create a debounce.decorator.js to handle this situation.
I think my way's advantage is easy to read and keep maintainability.
My question is:
1. Is it necessary to handle this? I mean, maybe react synthetic event will handle this for me?
2. My application has many events, I add debounce decorator for many of them. I test it, it works fine, but I am not sure I am correct. Because I saw many applications not deal with this.
No, all you need to do is, the moment user clicks a button, disable the button till you get the response. You can also disable other buttons too if required. Ex.
<button type="button" disabled={!this.clicked}>Button</button>
From a usability point of view, if the user clicks on a button/li/div element and you are executing some logic, it is better to give a visual indicator that some processing is happening, with a loader or a progress bar.
You can write a react component for a full page loader like this and show it to the user, which effectively prevents the user from clicking the element again while giving a visual clue as well.
I am facing an issue, while trying to start a phone call from my iOS app using:
UIApplication open(_:options: completionHandler:)
iOS shows an confirmation popup/alert before starting the call with two button Call & Cancel and CompletionHandler called with a Bool parameter having true/false based on button action in iOS 10.
But now in iOS11 the problem is that the completionHandler is being called automatically before tapping on "Cancel" or "Call" button of confirmation popup, always having true value.
Is this a bug in iOS11 or is there something that I am doing wrong?
There has been a behavior change in when the closure is called in iOS 11. I cant say if this behavior will be reverted or if this is a bug.
But one of the ways you can identify when the user interacted with the popup is by adding a notification listener around UIApplicationDidBecomeActive in the completion closure of openURL(). To identify whether the call was clicked or not you will need to create another custom notification and listener on the CTCallCenter. That was the best way through which I was able to identify it, there might be better solutions though :D
completionHandler will get a call if your given URL gets open success or failure, this has nothing to do with Cancel & Call buttons on Alert
see what Apple docs has to say about it HERE
completionHandler
The block to execute with the results. Provide a
value for this parameter if you want to be informed of the success or
failure of opening the URL. This block is executed asynchronously on
your app's main thread. The block has no return value and takes the
following parameter:
success
A Boolean indicating whether the URL was
opened successfully.
I'm writing a plugin that's modifying an existing UI. One thing I want to do is change what an existing menu item does.
This is all using the Gtk library.
The menu item (a GtkItem) is created from a GtkItemFactoryEntry (which is out of my control), and has its current behaviour defined by the callback in the GtkItemFactoryEntry.
I can get handle on the menu item using gtk_item_factory_get_widget()
and attach further actions to the menu item using gtk_signal_connect(), but I can't seem to disconnect the original callback using gtk_signal_disconnect() or gtk_signal_disconnect_by_func().
Is there any way I can remove or replace the original callback?
So the hack I came up with was that, since signal handlers are id'ed by a one-up counter, and I get a handler id for the callback I want to attach with gtk_signal_connect() to just run gtk_signal_disconnect() on every handler id from zero to one less than my new handler id.
It's ugly, but it works. And since no other signals are hung on the item, it doesn't break anything.
g_signal_handlers_disconnect_matched() offers more options with which to match the callback you wish to disconnect.
We have a button that fires a command which goes to the server to do some validation. This is done asynchronously and if the validation is okay (i.e. the user has the correct permission), I want to show the SaveFileDialog.
However, this is not a user initiated action which means calling the SaveFileDialog.ShowDialog() method raises a "Dialog must be user initiated" exception.
Is there any way to make this work the way I want?
To other option is to launch the SaveFileDialog and make the request after the file has been selected. Not ideal but it works.
JD.
There is no work around after all it would be a pointless restriction if there were a work around.
I think your alternative design choice make sense. You might consider using a busy indicator with the message "Validating..." or some such whilst the async validation occurs then do what ever it is you would have done once the asyc operation completes.