last day (14 days later) » 

11:05
greetings!
Hello. Thank you for joining.
I figured out the issue. There is a keypress event attached for document
fantastic, so you're able to type in the text box now?
$(document).keypress(function(event) {
									event.preventDefault();
									// Play-Pause Video
									if(event.keyCode == 32 && playing == false) {
										$('#match').get(0).play();
										playing = true;
									}else if(event.keyCode == 32 && playing == true) {
										$('#match').get(0).pause();
										playing = false;
									}

									// Vary Play Rate -- Hold down shift and presss 's' or 'n'
									if(event.keyCode == 83 && playingRateNormal == true && rateCount == 1) {
Yes.
wonderful
But I need to keep the event function, in that it tells me when a particular key is pressed.
11:07
gotcha, well the first thing that stands out to me is the "preventDefault" call on the event.
I bet that's what's causing your issue
but, it sounds like you don't want that to trigger when the user is typing in a text box
Yes! Figured that too!! Thank you.
I have one question related to bootstrap. Could you help me with that too? ;)
sure can
Thank you. When we generate a modal by clicking a button and then when the modal is closed, the button that triggered the modal remains in focus.
How to prevent that?
This causes trouble, when I press space bar. Since button is in focus and on pressing space bar, modal appears again!
I had also posted a query regarding this : stackoverflow.com/questions/29030212/…
try calling this.blur() after the click function triggers
Yes, I tried.
11:13
ah, hmm.
But that didn't help.
one second
one more second, I think I might've found a solution for you
11:27
got it
see this JSFiddle: jsfiddle.net/rr1bwfx2
this'll prevent the button from triggering when spacebar is pressed and the button has focus
whoops, the $(window).focus() isn't necessary
Please allow me 2 minutes, while I am trying.
no worries
I tried:
where goalb is :
<button type="button" class="btn btn-default btn-primary " data-toggle='modal' data-target='#goal' id='goalb'>Goal</button>
got it, so the issue is that your code that you added is never reached
also, it has to be on keyup, not on keypress
I'd recommend adding a keyup function with just that bit of code added
11:43
Okay,
Doesn't seem to work. When I click the button with data-target='#goal' a modal appears. To close the modal I press,escape. After the escape is pressed the goal button is in focus. So if I press, space bar modal again appears.
could you show your code for that?
just for the bit of code you added, that is
and if I seem a bit distracted, I am..haha, on the phone atm :)
The goal button :
The goal modal :
so, the html really shouldn't affect this behavior, instead this should all be affected by the JavaScript
11:53
Yes.
and the issue with the first bit of code you produced was two-fold:
because you added the focus declaration in an else-if statement with two other checks, it'll never get reached
because you're saying "if the space bar is pressed and it's playing { do this } if the space bar is pressed and it's not playing { do this }"
the second reason is because it's on keypress, which will not prevent the behavior from triggering a click event
so what I'd recommend is to add a $(document).keyup function which does the same test, and see if that works. if not, it might require a little more
unfortunately, I need to leave for a while. I'll check back later
When the modal is closed by pressing escape or by clicking close , (<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>) the button gains focus. We need align a blur event in between.
Sure. No problem.
as far as I can tell, calling blur will not prevent the behavior you're experiencing
the only way that I've found to prevent the behavior is by catching and stopping it when it happens
Okay.
I will check it and make it work. Thank you for your time. Much appreciated.
You may post the answer to query. I will accept it.

last day (14 days later) »