prismarine-web-client icon indicating copy to clipboard operation
prismarine-web-client copied to clipboard

solve ctrl+w problem

Open rom1504 opened this issue 3 years ago • 35 comments

people try to use ctrl+w for sprinting

what can we do to make this less confusing?

rom1504 avatar Mar 18 '21 18:03 rom1504

related #87

rom1504 avatar Mar 18 '21 18:03 rom1504

As a first line of defense we should probably add a beforeunload event handler checking if Ctrl is pressed and saving users from accidentally closing the tab

Moondarker avatar Mar 18 '21 18:03 Moondarker

yes I agree, good idea let's do it

rom1504 avatar Mar 18 '21 18:03 rom1504

https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event

rom1504 avatar Mar 20 '21 23:03 rom1504

https://stackoverflow.com/a/19538231/1658314

rom1504 avatar Mar 20 '21 23:03 rom1504

An other solution is to change how sprint work. In vanilla you can also double tap w to toggle sprint, so we could implement that and disable ctrl.

Karang avatar Mar 20 '21 23:03 Karang

and disable ctrl

that's the problem, we can't

rom1504 avatar Mar 20 '21 23:03 rom1504

maybe displaying a warning in the loading screen "don't press ctrl+w to sprint" could do the trick I guess...

rom1504 avatar Mar 20 '21 23:03 rom1504

and disable ctrl

that's the problem, we can't

I meant disabling sprinting with ctrl (not using it)

Karang avatar Mar 20 '21 23:03 Karang

yeah I understand but users try and exit the window

rom1504 avatar Mar 20 '21 23:03 rom1504

yeah I understand but users try and exit the window

If ctrl does nothing they will try once and not again when they see it doesn't work. The problem is because the feature is there, people will try to use it.

Karang avatar Mar 20 '21 23:03 Karang

We could just put a warning while loading and then use the beforeunload stuff

ShrimpyStuff avatar Mar 23 '21 01:03 ShrimpyStuff

I need to read all of the comments before I do because you guys said that

ShrimpyStuff avatar Mar 23 '21 02:03 ShrimpyStuff

and disable ctrl

that's the problem, we can't

but you can display the (browser standard) confirmation dialog. So the User wont instantly quit and also close 10 other Tabs :) You could set Sprint to another Key and also detecting Double W.

btw. Thanks for this great work here, I really like it!

muelleel avatar Mar 28 '21 21:03 muelleel

and disable ctrl

that's the problem, we can't

but you can display the (browser standard) confirmation dialog. So the User wont instantly quit and also close 10 other Tabs :)

You could set Sprint to another Key and also detecting Double W.

btw. Thanks for this great work here, I really like it!

We tried doing that and it looked ugly.

AwesomestCode avatar Mar 28 '21 21:03 AwesomestCode

yeah preventing closing the page feel like "ad popup" people should be able to just close it

rom1504 avatar Mar 28 '21 21:03 rom1504

yeah preventing closing the page feel like "ad popup" people should be able to just close it

Last time it didn't track the state of Ctrl and W keys

Moondarker avatar Apr 02 '21 23:04 Moondarker

if/when you add keybindings to the site, this wouldn’t be a problem. ctrl just wouldn’t be a valid sprint key

soqb avatar Jun 25 '21 07:06 soqb

The issue isn’t really not having a way to sprint. We could change the keybind to something else today if we wanted to. However, it’s much more difficult to correct muscle memory—most, if not all of the people on the dev team have been playing MC JE for years, and have pressing control-w to sprint as a habit.

On Fri, Jun 25, 2021 at 03:13, radiish @.***> wrote:

if/when you add keybindings to the site, this wouldn’t be a problem. ctrl just wouldn’t be a valid sprint key

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/prismarine-web-client/issues/117#issuecomment-868279318, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMVK4MVH56OCJPHHUQUM5LDTUQUCRANCNFSM4ZNFOAMA .

AwesomestCode avatar Jun 25 '21 13:06 AwesomestCode

Maybe pressing ctrl could enable sprint until the W key is depressed. This would be similar to vanilla behavior (i.e. you can walk and then tap ctrl to start sprinting) but also enable you to sprint somewhat normally (tap ctrl and then hold w).

Pandapip1 avatar Nov 04 '21 17:11 Pandapip1

im gonna try to do this

host008 avatar Nov 07 '21 21:11 host008

*fix

host008 avatar Nov 07 '21 21:11 host008

K I think I got it.

host008 avatar Nov 07 '21 21:11 host008

https://github.com/PrismarineJS/prismarine-web-client/pull/239

host008 avatar Nov 07 '21 21:11 host008

Adding alt as a key for sprinting could work (looks like #239 is trying to do this now). Keeping control around can be considered for non-QWERTY keyboards and also Electron where Control-W can be disabled.

extremeheat avatar Nov 08 '21 23:11 extremeheat

You can actually disable CTRL+W in your browser (if you use Chrome). You can install this extension (https://chrome.google.com/webstore/detail/disable-keyboard-shortcut/aidbmcboeighgdnilpdljbedbbiocphj) and go to chrome://extensions/shortcuts and click on the pen and safely do CTRL+W and then you can sprint in the game!

worldsgen avatar Nov 22 '21 16:11 worldsgen

We know that ctrl+W can be re-binded with a chrome extension. However, this will not be accepted, as mentioned here: https://github.com/PrismarineJS/prismarine-web-client/pull/239#pullrequestreview-799596125

Pandapip1 avatar Nov 22 '21 18:11 Pandapip1

I just found this experimental feature: https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/lock - might be useful when implemented?

Pandapip1 avatar Jan 25 '22 12:01 Pandapip1

I just found this experimental feature: developer.mozilla.org/en-US/docs/Web/API/Keyboard/lock - might be useful when

Hi! You're absolutely right!! This is the only way to cancel ctrl+w as you handle all keyboard interactions (except for long-esc, btw google remote desktop uses this API). The lock can be acquired when you go fullscreen, so I implemented the following:

  • When you press F11 - always fullscreen & acquire full keyboard access
  • When you press ESC from the pause menu - do the same only if setting Auto Fullscreen is enabled

Also, acquiring full keyboard access can fix ua errors when re-requesting pointerlock (the pointer is not locked when you double press esc too fast without fullscreen)


Btw another annoying thing that I've found is mouse acceleration but it was to fix with Mouse Raw Input (setting), which btw is enabled by default in java version. And also I managed to fix all known control usability issues, so please let me know if there are any problems...

All this fancy stuff is supported only in Chromium browsers, so I don't recommend using others like Firefox...

zardoy avatar Sep 01 '23 04:09 zardoy

All this fancy stuff is supported only in Chromium browsers, so I don't recommend using others like Firefox...

I mean... there are pretty good reasons to use FF instead of Chromium-based browsers. In fact, not supporting as many APIs is one of the reasons to use it, since Google has been known to use its dominant market share to do some pretty unethical stuff.

Nonetheless, in this case, IDK why Firefox doesn't support it. I can't think of any good reason.

Pandapip1 avatar Sep 01 '23 14:09 Pandapip1