Mouse Keys Left Click

You may notice that sometimes your mouse will 'double-click' an icon or in general, even though you only pressed the mouse button once. Review the details for each of the main causes of this issue by clicking the links below.

Double-click speed set too low

  • From the new layout, select Language and then click on Advanced settings in the left hand pane. Under the sub-heading 'Switching input methods', click on Change language bar hot keys. Highlight the top entry 'Between input languages' and then click the Change Key Sequence button.
  • Check the 'Turn on Mouse Keys' box and click 'OK.' Click the '8' key on the numeric keypad to move the mouse pointer up, the '2' key to move it down, the '6' key to move it to the right and '4' to move it to the left. Click '-' to select the right mouse button and then press.
  • Way 2: Set up Mouse Keys in Control Panel. Step 1: Access Control Panel. Step 2: Open Ease of Access. Step 3: Click Change how your mouse works to move on. Step 4: Choose Set up Mouse Keys. Step 5: In Pointer speed settings, move the scales to the left or the right so as to change the top speed and acceleration, or select Hold down CTRL to.

The most common culprit of the double-clicking issue is the double-click speed setting for your mouse is set too low. When set very low, clicking at two different times may be interpreted as a double-click instead. To adjust the double-click setting, follow the steps below for your version of Windows.

Windows 8 and 10

  1. Press the Windows key, type mouse settings, and press Enter.
  2. In the Settings window, under Related settings, click the Additional mouse options link.
  3. In the Mouse Properties window, click the Buttons tab, if not already selected.
  4. On the Buttons tab, adjust the slider for the Double-click speed option, then press OK.
  1. Test out the double-click speed adjustment to see if that helps resolve the double-clicking issue. Repeat the steps above, if needed, to adjust the setting again.

The keys that are involved in mouse keys are only the ones on the numerical keypad. 5 clicks the mouse, and the surrounding 8 numbers are used to move the cursor. / sets the 5 key to left click.-sets the 5 key to right click. sets the 5 key to left and right click simultaneously (useful for dropping an inventory of objects). This no longer works. Replacing the mouse keys by the numeric keypad is as follows: Typing 5 (with the numeric keypad) is equivalent to clicking the selected button. By default, the selected button is the primary button (nominally under index finger, left button for most right-handed people and right button for most left.

Windows 7 and earlier

  1. Open the Control Panel.
  2. Click or double-click the Mouse or Mouse Settings icon.
  3. In the Mouse Properties window, click the Buttons tab, if not already selected.
  4. On the Buttons tab, adjust the slider for the Double-click speed option, then press OK.
  1. Test out the double-click speed adjustment to see if that helps resolve the double-clicking issue. Repeat the steps above, if needed, to adjust the setting again.

Corrupt system files

In the Windows operating system, if system files become corrupt, it can cause problems with various hardware or software functionality. Whether or not a mouse single or double clicks can be impacted by corrupt Windows system files.

If you know the day the problem started happening with your mouse, you can try activating a restore point to take Windows back to a date before the problem started happening. Doing so can fix the corrupt system files and restore proper functionality to your mouse.

Dirty mouse

If dust and dirt is clogging up the mouse buttons, it can cause them to stick. A sticky mouse button could result in a double-click action, even if you clicked the mouse button only once. Additionally, if liquid is spilled on or around the mouse, it can cause the mouse buttons to be sticky, resulting in accidental double-click actions.

You can often clear out dust and dirt from around and under the mouse buttons by using compressed air to blow it out. Unfortunately, spilled liquid is more difficult, if not impossible, to clean out from under and around the mouse buttons. If the liquid is water, you can try letting the mouse dry out to see if that clears up the issue. If the liquid is something other than water, even after drying out, it often leaves behind a sticky residue that is very hard to clean out. For these cases, we recommend you replace the mouse.

Wireless signal interference

If you are using a wireless mouse, the double-clicking issue may be caused by interference of the mouse's wireless signal to the wireless receiver. If the wireless signal is disrupted by interference, it can cause the computer to receive incorrect signals or misinterpret signals from the mouse. Common types of interference include the following.

  • EMI (electromagnetic inteference) from the computer speakers.
  • Electrical interference from a computer monitor.
  • RFI (radio frequency interference) from a wireless network router or cordless phone.

To avoid EMI or electrical interference, try to position the mouse's wireless receiver away from a computer speaker or monitor. Even moving the receiver a few inches away can sometimes resolve the issue.

To greatly reduce or eliminate RFI, make sure the mouse's wireless receiver is not directly in line between the computer and wireless router. If there is a cordless phone near the computer, move the cordless phone's base several feet or more away from the computer.

Defective mouse

Another possible cause for the double-clicking problem is a malfunctioning mouse. It might have a defective circuit board or tension spring in it, causing it to incorrectly recognize a single click as a double-click action. If this is the case, the best resolution is to purchase a new mouse. It is not worth having a mouse fixed, as a new basic mouse is inexpensive.

If you have a more expensive mouse, like a gaming or multi-button programmable mouse, you can check if the mouse is under warranty and see about getting it repaired.

Additional information

  • See the click, double-click, and mouse dictionary definitions for further information about these terms.

In this chapter we’ll get into more details about mouse events and their properties.

Please note: such events may come not only from “mouse devices”, but are also from other devices, such as phones and tablets, where they are emulated for compatibility.

Mouse event types

We’ve already seen some of these events:

mousedown/mouseup
Mouse button is clicked/released over an element.
mouseover/mouseout
Mouse pointer comes over/out from an element.
mousemove
Every mouse move over an element triggers that event.
click
Triggers after mousedown and then mouseup over the same element if the left mouse button was used.
dblclick
Triggers after two clicks on the same element within a short timeframe. Rarely used nowadays.
contextmenu
Triggers when the right mouse button is pressed. There are other ways to open a context menu, e.g. using a special keyboard key, it triggers in that case also, so it’s not exactly the mouse event.

…There are several other events too, we’ll cover them later.

Events order

As you can see from the list above, a user action may trigger multiple events.

For instance, a left-button click first triggers mousedown, when the button is pressed, then mouseup and click when it’s released.

In cases when a single action initiates multiple events, their order is fixed. That is, the handlers are called in the order mousedownmouseupclick.

Click the button below and you’ll see the events. Try double-click too.

On the teststand below all mouse events are logged, and if there is more than a 1 second delay between them they are separated by a horizontal ruler.

Also we can see the button property that allows to detect the mouse button, it’s explained below.

Mouse button

Click-related events always have the button property, which allows to get the exact mouse button.

We usually don’t use it for click and contextmenu events, because the former happens only on left-click, and the latter – only on right-click.

Left Click Not Working

From the other hand, mousedown and mouseup handlers may need event.button, because these events trigger on any button, so button allows to distinguish between “right-mousedown” and “left-mousedown”.

The possible values of event.button are:

Button stateevent.button
Left button (primary)0
Middle button (auxiliary)1
Right button (secondary)2
X1 button (back)3
X2 button (forward)4

Most mouse devices only have the left and right buttons, so possible values are 0 or 2. Touch devices also generate similar events when one taps on them.

Also there’s event.buttons property that has all currently pressed buttons as an integer, one bit per button. In practice this property is very rarely used, you can find details at MDN if you ever need it.

Old code may use event.which property that’s an old non-standard way of getting a button, with possible values:

  • event.which 1 – left button,
  • event.which 2 – middle button,
  • event.which 3 – right button.

As of now, event.which is deprecated, we shouldn’t use it.

Modifiers: shift, alt, ctrl and meta

All mouse events include the information about pressed modifier keys.

Event properties:

  • shiftKey: Shift
  • altKey: Alt (or Opt for Mac)
  • ctrlKey: Ctrl
  • metaKey: Cmd for Mac

They are true if the corresponding key was pressed during the event.

For instance, the button below only works on Alt+Shift+click:

Attention: on Mac it’s usually Cmd instead of Ctrl

On Windows and Linux there are modifier keys Alt, Shift and Ctrl. On Mac there’s one more: Cmd, corresponding to the property metaKey.

Mouse Keys Left Click

In most applications, when Windows/Linux uses Ctrl, on Mac Cmd is used.

That is: where a Windows user presses Ctrl+Enter or Ctrl+A, a Mac user would press Cmd+Enter or Cmd+A, and so on.

So if we want to support combinations like Ctrl+click, then for Mac it makes sense to use Cmd+click. That’s more comfortable for Mac users.

Even if we’d like to force Mac users to Ctrl+click – that’s kind of difficult. The problem is: a left-click with Ctrl is interpreted as a right-click on MacOS, and it generates the contextmenu event, not click like Windows/Linux.

So if we want users of all operating systems to feel comfortable, then together with ctrlKey we should check metaKey.

For JS-code it means that we should check if (event.ctrlKey || event.metaKey).

Keyboard combinations are good as an addition to the workflow. So that if the visitor uses a keyboard – they work.

But if their device doesn’t have it – then there should be a way to live without modifier keys.

Coordinates: clientX/Y, pageX/Y

All mouse events provide coordinates in two flavours:

  1. Window-relative: clientX and clientY.
  2. Document-relative: pageX and pageY.

We already covered the difference between them in the chapter Coordinates.

In short, document-relative coordinates pageX/Y are counted from the left-upper corner of the document, and do not change when the page is scrolled, while clientX/Y are counted from the current window left-upper corner. When the page is scrolled, they change.

For instance, if we have a window of the size 500x500, and the mouse is in the left-upper corner, then clientX and clientY are 0, no matter how the page is scrolled.

And if the mouse is in the center, then clientX and clientY are 250, no matter what place in the document it is. They are similar to position:fixed in that aspect.

Move the mouse over the input field to see clientX/clientY (the example is in the iframe, so coordinates are relative to that iframe):

Preventing selection on mousedown

Double mouse click has a side-effect that may be disturbing in some interfaces: it selects text.

For instance, double-clicking on the text below selects it in addition to our handler:

If one presses the left mouse button and, without releasing it, moves the mouse, that also makes the selection, often unwanted.

There are multiple ways to prevent the selection, that you can read in the chapter Selection and Range.

In this particular case the most reasonable way is to prevent the browser action on mousedown. It prevents both these selections:

Now the bold element is not selected on double clicks, and pressing the left button on it won’t start the selection.

Please note: the text inside it is still selectable. However, the selection should start not on the text itself, but before or after it. Usually that’s fine for users.

If we want to disable selection to protect our page content from copy-pasting, then we can use another event: oncopy.

If you try to copy a piece of text in the <div>, that won’t work, because the default action oncopy is prevented.

Surely the user has access to HTML-source of the page, and can take the content from there, but not everyone knows how to do it.

Summary

Mouse Keys Only Left Clicking

Mouse events have the following properties:

  • Button: button.

  • Modifier keys (true if pressed): altKey, ctrlKey, shiftKey and metaKey (Mac).

    • If you want to handle Ctrl, then don’t forget Mac users, they usually use Cmd, so it’s better to check if (e.metaKey || e.ctrlKey).
  • Window-relative coordinates: clientX/clientY.

  • Document-relative coordinates: pageX/pageY.

The default browser action of mousedown is text selection, if it’s not good for the interface, then it should be prevented.

Mouse Keys Right Click Instead Of Left Click

In the next chapter we’ll see more details about events that follow pointer movement and how to track element changes under it.