Middle clicking

Official announcements from the creators

Middle clicking

Postby super_dipsy » 15 Aug 2019, 07:10

This is really just a word of warning while we work our what to do about this issue.

It only recently came to my attention that such a thing as middle clicking on a mouse even exists :oops: . Maybe it's a good job I am passing development over to more capable hands!

Anyway, it turns out some people like to middle click buttons rather than left click as normal, because middle clicking always opens a new window or tab. The problem though is that this technology has a really crappy design (technical term). When you click on a button, you are calling up an action of some sort BUT programs often do validation, warnings, confirmation dialogues, prep work etc first before going on to the action. This is to avoid you going into an action with bum data or by mistake or without realizing the consequences, or maybe to optimize the action when it takes place. Turns out the people who designed middle clicking thought it would be really cool just to go straight to the action without doing any of the other stuff carefully put in place by the programmers :cry:

One example (the one that triggered this post) is when you click Join to join a game. Because people used to get upset when they accidentally hit the wrong Join button on the list of games and ended up taking over a 1 centre surrendered country by mistake, we put a confirmation dialogue in warning you that you were about to join a game as a surrendered country and asking if you want to continue. But of course if you middle click instead of left click, you wont get any warning. There are many other places where the code tries to help you or make things better triggered by the click which will be bypassed if you middle click. Indeed, there are even places where the code simply wont work - middle clicking on a box in the Orders dialog for example.

Without going through the entire codebase, we can't anticipate where this may affect you or how. Create game, searching for games, buying credits, etc all could be affected.

What quite a few websites do to avoid the issue is they disable middle clicking so it does not do anything. We are reluctant to do that because some people may be happy to take the risks given they like the facility to always open a new window. What we (ie Nopunin10did :) ) may do is try to go through the buttons that are affected and just disable middle clicking for them.

However the key point of this post is to warn you that if you want to middle click, you need to be aware you are flying blind; it will probably work, but you wont get any warnings or validation or optimization, and in some cases it is possible it wont work. One where it wont work that just popped into my mind is trying to create a 2-player challenge game which I think will fail.
User avatar
super_dipsy
Premium Member
 
Posts: 12068
Joined: 04 Nov 2009, 17:43
Class: Ambassador
Standard rating: 1000
All-game rating: 931
Timezone: GMT

Re: Middle clicking

Postby NoPunIn10Did » 15 Aug 2019, 16:52

I am looking to prevent middle clicking on specific UI elements that aren’t standard links. Disabling middle click across the whole site would be an inconvenience, but certain buttons should never be middle-clicked.
Lead Volunteer Developer & Forum Admin

Variant GM & Designer
User avatar
NoPunIn10Did
Premium Member
 
Posts: 2476
Joined: 17 Aug 2011, 00:17
Location: North Carolina
Class: Ambassador
Standard rating: 1000
All-game rating: 1451
Timezone: GMT-5

Re: Middle clicking

Postby Woolgie » 15 Aug 2019, 19:12

Ah I remember middle clicking was big on Windows 3.1.

Didn’t the middle button get axed circa 2002? Or are we talking about wheel clicking?
Jon Stark in Diplomacy of Ice and Fire III - Winter is coming
GMing my Star Wars variant
Still proud of my solo in Versailles Fog Chaos
Woolgie
Premium Member
 
Posts: 192
Joined: 15 Feb 2016, 19:43
Location: Chesterfield, UK
Class: Ambassador
Standard rating: 1028
All-game rating: 920
Timezone: GMT

Re: Middle clicking

Postby NoPunIn10Did » 15 Aug 2019, 20:18

Woolgie wrote:Ah I remember middle clicking was big on Windows 3.1.

Didn’t the middle button get axed circa 2002? Or are we talking about wheel clicking?


Wheel clicking is middle clicking.
Lead Volunteer Developer & Forum Admin

Variant GM & Designer
User avatar
NoPunIn10Did
Premium Member
 
Posts: 2476
Joined: 17 Aug 2011, 00:17
Location: North Carolina
Class: Ambassador
Standard rating: 1000
All-game rating: 1451
Timezone: GMT-5

Re: Middle clicking

Postby joe92 » 16 Aug 2019, 10:20

I middle click all the time, dude.
Designer: Emergence, Modern Extended
GM'ing: Nothing

Platinum Classicist

Taking a break
User avatar
joe92
 
Posts: 1055
Joined: 02 Feb 2013, 00:26
Location: Leeds, GB
Class: Star Ambassador
Standard rating: 1106
All-game rating: 1721
Timezone: GMT

Re: Middle clicking

Postby V » 16 Aug 2019, 14:39

“Click”, “Mouse”, “Wheel”, I seem to remember these terms from the early Neolithic (Microsoft) period of computing. I’ll just pop down to a neighbouring museum & refresh my memory :D ...
Platinum Classicist
Voilà! In view, a humble vaudevillian veteran cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished.
V
 
Posts: 622
Joined: 04 May 2014, 21:28
Class: Star Ambassador
Standard rating: (1718)
All-game rating: (1754)
Timezone: GMT-6

Re: Middle clicking

Postby marsman57 » 16 Aug 2019, 15:34

Professional web application developer here.

The issue with joining the game is that the code appears to be written so that the "Join Game" button just submits the form attached to the relevant game ID. Your confirmation is only an onclick event. I suspect that the best easy fix would be for the href to go away and your onclick instead call a JavaScript function which would then do the check. If you middle-clicked that URL, nothing would happen. Well, a new tab would open, but it would be blank.

So something like...
<a href="javascript:jQuery('#join_123456').submit();" class="btnred flright" onclick="return confirm('You are about to join an active game as a surrendered country. Confirm?')"><span><span>Join Game</span></span></a>

Becomes...
<a class="btnred flright" onclick="return joinGame('#join_1123456');"><span><span>Join Game</span></span></a>

with the new JavaScript function...
function joinGame(game_id)
{
if (confirm('You are about to join an active game as a surrendered country. Confirm?')) {
jquery(game_id).submit();
return true;
}
return false;
}

Obviously, real production code would be a little bit more complex so that it would identify if the game was surrendered, but whatever you are doing in the form now to add that onclick event, could just add a second parameter indicating it is a surrendered position.

But that being said, the site really could use a complete AJAX / responsive overhaul that would take a better approach than the form submission page refreshes that the site uses. Also, I would use a javascript package for dialog boxes and not the baked in confirm window, but that may just be my aesthetic. That is a pretty big project to undertake though. So I can understand the hesitancy.

Edit: After doing a quick test with some JavaScript that would launch a confirm window, I confirmed two things.
1. If you remove the href, you will have to apply explicitly to the stylesheet to make the cursor turn into a pointer.
2. Middle-click does nothing if there is no href on the tag.'

Feel free to PM anytime if you want to discuss things like this.
marsman57
 
Posts: 1473
Joined: 05 Oct 2009, 21:42
Class: Star Ambassador
Standard rating: 1118
All-game rating: 1128
Timezone: GMT

Re: Middle clicking

Postby NoPunIn10Did » 16 Aug 2019, 15:43

marsman57 wrote:Professional web application developer here.

The issue with joining the game is that the code appears to be written so that the "Join Game" button just submits the form attached to the relevant game ID. Your confirmation is only an onclick event. I suspect that the best easy fix would be for the href to go away and your onclick instead call a JavaScript function which would then do the check. If you middle-clicked that URL, nothing would happen. Well, a new tab would open, but it would be blank.

So something like...
<a href="javascript:jQuery('#join_123456').submit();" class="btnred flright" onclick="return confirm('You are about to join an active game as a surrendered country. Confirm?')"><span><span>Join Game</span></span></a>

Becomes...
<a class="btnred flright" onclick="return joinGame('#join_1123456');"><span><span>Join Game</span></span></a>

with the new JavaScript function...
function joinGame(game_id)
{
if (confirm('You are about to join an active game as a surrendered country. Confirm?')")) {
jquery(game_id).submit();
return true;
}
return false;
}

This is really helpful. I'll experiment with this.

marsman57 wrote:But that being said, the site really could use a complete AJAX / responsive overhaul that would take a better approach than the form submission page refreshes that the site uses. That is a pretty big project to undertake though. So I can understand the hesitancy.

It's definitely on my wishlist. I'd love to convert the site over to a robust framework like Laravel, but that may entail more time, effort, and risk than I'd be able to handle at this time.
Lead Volunteer Developer & Forum Admin

Variant GM & Designer
User avatar
NoPunIn10Did
Premium Member
 
Posts: 2476
Joined: 17 Aug 2011, 00:17
Location: North Carolina
Class: Ambassador
Standard rating: 1000
All-game rating: 1451
Timezone: GMT-5

Re: Middle clicking

Postby marsman57 » 18 Aug 2019, 23:48

You're welcome! Hopefully that can clear up some of the worst offenses.
marsman57
 
Posts: 1473
Joined: 05 Oct 2009, 21:42
Class: Star Ambassador
Standard rating: 1118
All-game rating: 1128
Timezone: GMT

Re: Middle clicking

Postby TheCraw » 06 Sep 2019, 18:44

Using the "middle button" is considered rude.
Very clever, Mr. Smart...
User avatar
TheCraw
 
Posts: 17252
Joined: 05 Dec 2008, 23:39
Location: lurking, baby.... lurking.
Class: Shropshire slasher
All-game rating: 1,000,000
Timezone: GMT-5


Return to Announcements

Who is online

Users browsing this forum: No registered users and 1 guest