WICG / EventListenerOptions

An extension to the DOM event pattern to allow authors to disable support for preventDefault
Other
1.17k stars 140 forks source link

Replace mayCancel with blocksScroll? #14

Closed RByers closed 8 years ago

RByers commented 9 years ago

My original proposal on public-pointerevents suggested a blocksScroll option instead of this mayCancel option. Maybe that would be better after all?

Benefits:

Disadvantages:

Previously Olli Pettay argued:

Definitely not this. This is not a strong enough case to change an API which has existed for 15+ years, IMO.

And then

So, "I'm not going to call preventDefault()" might be such, useful also in other cases than just with wheel. A bit odd API, but might be useful, really useful.

Anyone else have opinions here?

ojanvafai commented 9 years ago

I actually tend to agree with Olli's desire for a more general name. My intuition is that we will find other non-scroll-related uses for this in the future. How about "blocksDefaultAction"? That clearly associates with preventDefault, would also be usable in the future for the scroll event handler case you mention and would hopefully avoid the potential confusion I mention in #13.

RByers commented 9 years ago

I'm trying to separate a bit the debate over the right name / spec wording (#13) from the fundamental semantics (this bug). It sounds like 'blocksDefaultAction' would have more of the semantics I'm proposing here for blocksScroll, right? Eg. what would the behavior be for events like 'scroll' and 'mousemove' which have no default action - do we need some mechanism to indicate failure? What would the default value be when unspecified (do we need to reintroduce a third "auto" value)?

Also I'm not sure "blocksDefaultAction" would really make sense for "scroll". I don't think we could add a default action to "scroll" - what would it mean for the page to call preventDefault on it (we can't, for example, undo the scroll)? But maybe we could fudge it to be close enough?

smaug---- commented 9 years ago

indicate failure? What failure? There isn't anything to cancel on "scroll". "scroll" event happens after actually scrolling.

RByers commented 9 years ago

Right, my point exactly. So you're suggesting that blocksDefaultAction=true for scroll or mousemove events would be silently ignored since there is no default action, right? Ojan was suggesting that we might want to use blocksDefaultsAction=true on scroll events in the future to enable JS synchronized scrolling (one of my original goals with scroll-blocks-on but not something I'm actively pursuing at the moment).

RByers commented 8 years ago

@esprehn says:

I don't like making this specific to scrolling, that doesn't explain what it really means in terms of the capabilities of the event handler. We probably want to use this for other event types where we want to change the time the event dispatches based on if you require the ability to cancel or not as well.

RByers commented 8 years ago

Consensus seems to be to stick with the general semantics of mayCancel (but we can still debate the exact name in #13).