Vue.js / Vuex click function is not working for cmd + click - vue.js

I want to fire a function for cmd + click. But it looks impossible at least for my keyboard.
My keyboard type:
Macbook Turkish Q
It seems like because of Macbook CMD key works depend on browser, How can I set new key codes for vue.js easily?
<div #click="foo($event)" ></div>
foo(e){
console.log(e.ctrlKey) // If I press CMD and Click to DIV result always FALSE
console.log(e.shiftKey) // If I press SHIFT and Click to DIV result TRUE (shift working but cmd is not working)
}

If you check e.metaKey it works! it handles CMD now.
Thank you.

Related

How to have a div rather than a button for pivot link

I want to customize a PivotItem to make it close-able (kind of like browser tabs).
I provided a custom onRenderItemLink implementation do display an X icon on the right side of the tab, and an onClick method on that icon that will close the tab.
The main issue I'm facing is that this PivotItem is wrapped with a button (Pivot.Base.tsx renders a Commandbutton), that intercepts all onClick events on Firefox.
Firefox does not allow onClick events under a Button (this seems to be in accordance with the standard, so it's not considered a bug), so i can never close a tab on Firefox.
Is there any way to force Fabric UI to create a div rather than a button in this scenario?
Is there any other way to force a div there (some way to intercept what fabric ui creates and switch the button with a div)?
Advice appreciated.
Ended up closing the tab if the button was clicked on its right side
const clickX = clickEvent.pageX;
const buttonRight = clickEvent.currentTarget.offsetLeft + clickEvent.currentTarget.offsetWidth ;
if (buttonRight - clickX <= 40) {
removeTab(tab);
}

Does TextField fireDoneEvent() to call stopEditing() in order to close the virtual keyyboard?

I can close the virtualkeyboard from a button by calling textField.stopEditing. However, I would have expecting setting a DoneListener to close the virtualkeyboard as well when "Search" or "Go" is pressed.
The DoneListener does fire and the code is executed, but the virtualkeyboard remains open. I've tried adding a stopEditing to the DoneListerer, even placing stopEditing callSerially.
I just tried this on my Android OPO device and it worked as expected. The second field did nothing but the first folded the keyboard like a champ:
Form hi = new Form("TextTest", BoxLayout.y());
TextField other = new TextField("");
TextField ttt = new TextField("");
hi.add(ttt).add(other);
ttt.setDoneListener(e -> {
hi.add(ttt.getText());
hi.getContentPane().animateLayout(200);
});
hi.show();

Selenium Chromedriver control issue

I have started using chrome for selenium and its working fine but when I open a new tab the control goes back to the main tab and executes the script there instead of the new tab. can someone help me how to tackle this issue.
try this
ArrayList<String> tabs2 = new ArrayList<String>(driver.getWindowHandles());
driver.switchTo().window(tabs2.get(tabs2.size()-1));
//Then do something
# Open the link in a new tab by sending key strokes on the element
# Use: Keys.CONTROL + Keys.SHIFT + Keys.RETURN to open tab on top of the stack
url.send_keys(Keys.CONTROL + Keys.RETURN)
# Save the window opener (current window)
main_window = browser.current_window_handle
# Switch tab to the new tab
browser.find_element_by_tag_name('body').send_keys(Keys.CONTROL + Keys.TAB)
# Put focus on current window which will
browser.switch_to_window(browser.window_handles[1])
# do whatever you have to do on this page

jquery .submit() function not work in ios

I have bellow code:
$('#my-form').submit(function() {
//Do something...
});
I have a form and when user press "Enter" key form should submit. It is working fine in all platforms but in ios safari not work. in the virtual keyboard of iphone there is a blue button as "Search" and when I click on it no reaction..!
Can any one help me?

Titanium Appcelerator Video Player Back Button on Android

I am new to Titanium App Development. I am making a title list of videos using a ListView. When I click on an item, the specific video plays fine. However when I press the back button in Android, the application exits instead of going back to the previous list of videos. I have tried android:back and androidback event of the window but still the same. How should I fix this??? By the way I am using the Alloy Framework in Titanium
index.js
videos.fetch({query: 'select * from '+ videos.config.adapter.collection_name + ' where video_id = '+ vid_id});
var args;
for (var vd=0 ; vd < videos.length; vd++){
var e = JSON.parse(JSON.stringify(videos.at(vd)));
args = {
parent_id : lsn_sub,
video_data : e.video_data
};
console.log(args.video_data);
var mediaview = Alloy.createController("media", args).getView();
mediaview.open();
media.js
var parent_view = args.parent_id;
var vid_media = args.video_data;
console.log("parent source: "+parent_view);
console.log($.vid_media.url);
$.vid_media.url = vid_media ;
$.media.addEventListener('androidback', function(e){
alert("android back");
});
views/media.xml
<Alloy>
<Window class="container">
<VideoPlayer id="vid_media" ns="Ti.Media" ></VideoPlayer>
</Window>
The back button exits the application, not going back to previous screen.
Set the model property of your second window true.
<SecondWindow class="container" modal="true"></SecondWindow>
Also set modal and exitOnClose true on your first window if you want to close the app when user press android back on your first screen.
<FirstWindow class="container" modal="true" exitOnClose></FirstWindow >
there is no to add android:back event for it.
Hope this will help you
Thank you for the great help #suraj and #victor, but I figured it out already.
The reason for it to be not working is because I was testing it only in the simulator, not on a real device. When I run it on the real device, the 'back button' of the android actually works fine. It stops my video and goes back to the previous screen.
We should really test on a real device rather than relying on a simulator. Have a great day! :)
Another possible solution
is to cancel the bubbling effect of the androidback event,
$.media.addEventListener('androidback', function(e) {
e.cancelBubble = true;
[...Your logic here...]
}