W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Re: Mouse Lock

From: Adam Barth <w3c@adambarth.com>
Date: Mon, 20 Jun 2011 17:39:21 -0700
Message-ID: <BANLkTimkUAxi617sEcnq9Fer6zLAruJH5w@mail.gmail.com>
To: "Gregg Tavares (wrk)" <gman@google.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Olli@pettay.fi, Jonas Sicking <jonas@sicking.cc>, Vincent Scheib <scheib@google.com>, Brandon Andrews <warcraftthreeft@sbcglobal.net>, Glenn Maynard <glenn@zewt.org>, Charles Pritchard <chuck@jumis.com>, Kenneth Russell <kbr@google.com>, robert@ocallahan.org, public-webapps@w3.org
On Mon, Jun 20, 2011 at 5:14 PM, Gregg Tavares (wrk) <gman@google.com> wrote:
> On Mon, Jun 20, 2011 at 4:53 PM, Adam Barth <w3c@adambarth.com> wrote:
>> On Mon, Jun 20, 2011 at 3:30 PM, Tab Atkins Jr. <jackalmage@gmail.com>
>> wrote:
>> > On Mon, Jun 20, 2011 at 3:26 PM, Olli Pettay <Olli.Pettay@helsinki.fi>
>> > wrote:
>> >> On 06/21/2011 01:08 AM, Tab Atkins Jr. wrote:
>> >>> On Mon, Jun 20, 2011 at 3:03 PM, Olli Pettay<Olli.Pettay@helsinki.fi>
>> >>>  wrote:
>> >>>> On 06/21/2011 12:25 AM, Tab Atkins Jr. wrote:
>> >>>>> The use-case is non-fullscreen games and similar, where you'd prefer
>> >>>>> to lock the mouse as soon as the user clicks into the game.
>> >>>>>  Minecraft
>> >>>>> is the first example that pops into my head that works like this -
>> >>>>> it's windowed, and mouselocks you as soon as you click at it.
>> >>>>
>> >>>> And how would user unlock when some evil sites locks the mouse?
>> >>>> Could you give some concrete example about
>> >>>> " It's probably also useful to instruct the user how to release the
>> >>>> lock."
>> >>>
>> >>> I'm assuming that the browser reserves some logical key (like Esc) for
>> >>> releasing things like this, and communicates this in the overlay
>> >>> message.
>> >>
>> >> And what if the web page moves focus to some browser window, so that
>> >> ESC
>> >> is fired there? Or what if the web page moves the window to be outside
>> >> the
>> >> screen so that user can't actually see the message how to
>> >> unlock mouse?
>> >
>> > How is a webpage able to do either of those things?
>>
>> window.focus()
>
> Seems like calling window.focus() would cancel mouselock. As I suspect would
> changing the focus any other way like Alt-Tab, Cmd-Tab, etc.

That sounds like a good security property.  Maybe say that the window
/ tab loses mouse lock if it ever loses focus?

Adam
Received on Tuesday, 21 June 2011 00:40:20 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:45 GMT