onClick and mouseup/mousedown relationship in the spec - onclick

I see some answers and MDN claims that mouseup and mousedown has to have the same target so that onClick can be fired (on that target). Not that I don't believe it, I just want to find the exact paragraph in the Event spec that says this, to no avail.
So where is this specified?

Related

Accessibility WAVE scan on asp.net menu shows errors

We're doing a WAVE scan of our application to detect accessibility issues. One that I'm looking at now is the "Device dependent event handler". These are shown on the asp:Menu controls. What seems to be the relevant messages says: "an onmouseover event but not an onfocus event". When I look at the page source I do see the generated html like:
<td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="ctl00_MainMenun4">
This suggests to me that it needs an onfocus event handler that does the same as the onmouseover handler. Am I correct in this assumption. Is there a way to get asp.net to generate this or can/should I look at a way to manually inject this? If the latter, any suggestions?
Thanks for any help!
Adding an onfocus event handler is not sufficient to make the table cell accessible. Table cells are not focusable elements. (Focusable elements are usually a elements with an href attribute, link elements with an href attribute, button, input when type is not "hidden", select and textarea.)
In order to make other elements focusable, you should set the tabindex attribute to "0". This will put the td element in your example in the tabbing order and make it reachable with a keyboard. If it can receive keyboard focus, it will also be able to fire the focus event that your listener will be waiting for.
I found the answer. See this MS article. For the asp:Menu controls I needed to set the Menu's RenderingMode to MenuRenderingMode.List and change the pages element in the web.config controlRenderingCompatibilityVersion="4.0".
<td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="ctl00_MainMenun4">
This suggests to me that it needs an onfocus event handler that does the same as the onmouseover handler. Am I correct in this assumption. Is there a way to get asp.net to generate this
It depends on what is inside your td
For instance, you can perfectly have:
<td onmouseover="func_somewhat()">Click</td>
Putting onfocus and tabindex on the td element will lead to accessibility problem due to the fact that the element itself contains a tabable element.
And this code might be plainly accessible, as long as selecting the inner link with the keyboard permit to achieve what you are expecting.
If the element inside the td does not have any focusable element, then you may add the onfocus event handler on the td itself but you have to satisfy more conditions :
the td should be focusable (tabindex)
the td should be indicated as being a role=button or role=link depending on the lead action
the table should have a presentation role if it's used for presentation (which is apparently the case here)

Why can't I hook on html5 video play event?

I am using an HTML5 video tag with videoJS (last stable release, 4.12). I have no trouble to get the loadedmetadata event but for some reason I probably missed, I can't hook using the "meteor way" on the video object play event.
My template events code:
Template.Player.events({
'loadedmetadata #video_player':function (e,t) {
console.log(e.target); //working fine
},
'play #video_player':function(e,t){
console.log("play!");//now it works
}
});
I am debugging on Chrome but i guess it is not browser related.
edit:
It appears that it works when I don't use id or class selectors. Since I have only one video tag on my template, I can catch the play event by doing this:
Template.Player.events({
'play video':function(e,t){
console.log("play!");//not working
}
});
I still don't buy the fact that meteor can't handle that. If so, why? What is the difference between loadedmetadata and play events that allows the first to use an id selector when the latter can't?
play triggers only when playback is resumed, playing triggers every
time playback starts.
#Oskar, you are right when I look at the documentation. However, in my case, play triggers both when starting a video and when resuming it after a pause.
First off, make sure you're using the correct event - play triggers only when playback is resumed, playing triggers every time playback starts.
Looking at the Meteor docs, these are the events that are "officially" supported:
Event types and their uses include:
click
Mouse click on any element, including a link, button, form control, or div. Use preventDefault() to prevent a clicked link from being followed. Some ways of activating an element from the keyboard also fire click.
dblclick
Double-click.
focus, blur
A text input field or other form control gains or loses focus. You can make any element focusable by giving it a tabindex property. Browsers differ on whether links, checkboxes, and radio buttons are natively focusable. These events do not bubble.
change
A checkbox or radio button changes state. For text fields, use blur or key events to respond to changes.
mouseenter, mouseleave
The pointer enters or leaves the bounds of an element. These events do not bubble.
mousedown, mouseup
The mouse button is newly down or up.
keydown, keypress, keyup
The user presses a keyboard key. keypress is most useful for catching typing in text fields, while keydown and keyup can be used for arrow keys or modifier keys.
Other DOM events are available as well, but for the events above, Meteor has taken some care to ensure that they work uniformly in all browsers.

setting the default button in preinitialization

I have a more than one container in a view. I am trying to set default button at the moment page is loaded so that when I press enter, function that handles keydown event called. If I simply set default button in preinit() function, it does not work.
How can I do this ?
It's tough to debug "Does not work" sometimes. But, in this case I suspect you get a "Null value" style error.
The preinitialize event is fired before createChildren() so most likely the button you want make the "Default" doesn't exist yet. More info about the Flex Component LifeCycle.
You can move your code to the initialize event.
I assume that by "setting the default" you mean you are using the FocusManager to give your button focus?
Assuming I understand your question correctly, you need to do two things to make this work.
Set the defaultButton
Set focus to the container or some child of the container
As #Flextras said, preinit may also not be the best choice for this.
If the container is declared in MXML, I recommend setting the defaultButton property in the MXML declaration, and setting focus on creationComplete.

Qt: How can I receive events fired by QWebElement objects?

I want to receive notifications whenever links are clicked or text fields are changed in a Webkit instance in Qt. How can I hook up event listeners to a QWebElement?
I know I can put some Javascript on each element’s onchange / onclick handler, but I’m looking for a cleaner solution.
Looks like the only way (as of Qt 4.6) is JavaScript.
According to this TODO list for WebKit, there are plans to add a QWebElement::connectEvent() method.

How to capture paste event from right-click context menu?

I have a textbox in ASP.NET web form, and I need to catch the paste event from right-click context menu. But I can't see where I can catch the associated event.
The onchange event is no use, as this is only triggered when the input field loses focus. Neither does OnKeyDown event since it is not a mouse event.
Any solution?
It is a common problem to which exists no good solution.
There is no cross-browser way to capture mouse paste event.
People are getting away with running a timer to detect any change soon after it's happened and then to react to it.
There is the paste event in some but not all browsers. IE has had it since version 4 or 5, I think, as well as beforepaste. Firefox I think got the paste event from version 3.0, and recent versions of WebKit have it (Chrome and Safari 4 have it at least), don't know about Opera. You'd have to research the specifics such as precisely which browsers support it and which element raise the event, but I would say it's still not widely enough supported to use on the general web.

Resources