-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit setZoomLevel() to the local user #14
Comments
Here's a simpler approach: That's it. If anyone is aware of a way to specify that in spec language, I think that's sufficient. However, I could not yet find a way to specify this formally. I consulted a colleague who has faced a similar challenge, and he says that they went with the following work-around:
Clarifications:
A JSFiddle sanity-checking these claims is here: https://jsfiddle.net/kxa01sh6/ The resulting API shape is: partial interface CaptureController {
Promise<undefined> setZoomLevel(long zoomLevel, Event event);
}; The former usage sample now reads: const controller = new CaptureController();
const zoomIncreaseButton = document.getElementById('zoomIncreaseButton');
zoomIncreaseButton.addEventListener('click', event => {
const levels = CaptureController.getSupportedZoomLevels();
const index = levels.indexOf(controller.getZoomLevel());
const newZoomLevel = levels[Math.min(index + 1, levels.length - 1)];
controller.setZoomLevel(newZoomLevel, event);
}); Note how this is a perfectly normal click-handler, with the only unusual portion being how the |
Wouldn't this let you call the api from a |
Yes, it would allow that. (As did the alternative approach we discussed during TPAC, which got a positive response.) I don't think that's a problem, but in the interest of starting out conservative, I am open to adding the following:
Would that dispel your concerns? |
Getting back to the issue of specifying this, here is another option:
A supposed problem is that this field is marked as "legacy", but I don't think this is critical here. |
Our DOM team says the UA probably doesn't need the
or maybe even
But let's ensure we have agreement about desired behavior first, to avoid surprises like mousemove.
If we step up a level, yes. It sounds like we want zoom controls to work through intentional and primary user interactions with That sounds fine to me. Might it work to start by just writing those requirements in prose, and leave the UA to figure out how? |
Thank you for checking with them.
As I was drafting my response to this possibility - that we need a
I believe we have consensus here, as indicated by my previous comment and my addition of permitted event types to the spec. Do we agree?
That's right.
Could you please advise which normative parts of the spec you propose to remove, and which non-normative prose you suggest to add? |
When discussing the APIs proposed by this spec, Mozilla and Apple raised concerns over the possibility for an app to delegate control to a remote user. The approach of captureWheel was generally seen as appropriate to mitigate these concerns. I suggest we adopt a similar approach to mitigate the same concerns for zoom-control.
Consider:
Then specify that when the event indicated by
selector
(e.g. "click") happens onelement
, if it is a trusted event, then:handler
.Effectively, this allows changing the zoom level only from within a handler, that is only invoked in response to immediate activity by the local user (cf. isTrusted). But it doesn't specify what that activity is - it allows it to be
click
, sliding a slider, etc.Example:
Wdyt, @youennf and @jan-ivar?
The text was updated successfully, but these errors were encountered: