Skip to content

Commit

Permalink
MouseEvent - remove experimental on features and tidy (#10220)
Browse files Browse the repository at this point in the history
* MouseEvent - remove experimental on features and tidy

* Remove legacy compatibility info from text
  • Loading branch information
hamishwillee authored Nov 5, 2021
1 parent 3f10cea commit d40315b
Show file tree
Hide file tree
Showing 24 changed files with 161 additions and 378 deletions.
26 changes: 7 additions & 19 deletions files/en-us/web/api/mouseevent/altkey/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,20 @@ browser-compat: api.MouseEvent.altKey
---
{{APIRef("DOM Events")}}

The **`MouseEvent.altKey`** read-only property is a
boolean value that indicates whether the <kbd>alt</kbd> key was pressed or not
when a given mouse event occurs.
The **`MouseEvent.altKey`** read-only property is a boolean value that indicates whether the <kbd>alt</kbd> key was pressed or not when a given mouse event occurs.

Be aware that the browser can't always detect the <kbd>alt</kbd> key on some operating
systems. On some Linux variants, for example, a left mouse click combined with
the <kbd>alt</kbd> key is used to move or resize windows.
Be aware that the browser can't always detect the <kbd>alt</kbd> key on some operating systems.
On some Linux variants, for example, a left mouse click combined with the <kbd>alt</kbd> key is used to move or resize windows.

> **Note:** On Macintosh keyboards, this key is also known as
> the <kbd>option</kbd> key.
> **Note:** On Macintosh keyboards, this key is also known as the <kbd>option</kbd> key.
## Syntax
## Value

```js
var altKeyPressed = instanceOfMouseEvent.altKey
```

### Return value

A boolean value, where `true` indicates that the key is pressed, and
`false` indicates that the key is _not_ pressed.
A boolean value, where `true` indicates that the key is pressed, and `false` indicates that the key is _not_ pressed.

## Example

This example logs the `altKey` property when you trigger a
{{Event("click")}} event.
This example logs the `altKey` property when you trigger a {{Event("click")}} event.

### HTML

Expand Down
35 changes: 10 additions & 25 deletions files/en-us/web/api/mouseevent/button/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,16 @@ browser-compat: api.MouseEvent.button
---
{{APIRef("DOM Events")}}

The **`MouseEvent.button`** read-only property indicates which
button was pressed on the mouse to trigger the event.
The **`MouseEvent.button`** read-only property indicates which button was pressed on the mouse to trigger the event.

This property only guarantees to indicate which buttons are pressed during events
caused by pressing or releasing one or multiple buttons. As such, it is not reliable for
events such as {{event("mouseenter")}}, {{event("mouseleave")}}, {{event("mouseover")}},
{{event("mouseout")}} or {{event("mousemove")}}.
This property only guarantees to indicate which buttons are pressed during events caused by pressing or releasing one or multiple buttons.
As such, it is not reliable for events such as {{event("mouseenter")}}, {{event("mouseleave")}}, {{event("mouseover")}}, {{event("mouseout")}} or {{event("mousemove")}}.

Users may change the configuration of buttons on their pointing device so that if an
event's button property is zero, it may not have been caused by the button that is
physically left–most on the pointing device; however, it should behave as if the left
button was clicked in the standard button layout.
Users may change the configuration of buttons on their pointing device so that if an event's button property is zero, it may not have been caused by the button that is physically left–most on the pointing device; however, it should behave as if the left button was clicked in the standard button layout.

> **Note:** Do not confuse this property with the
> {{domxref("MouseEvent.buttons")}} property, which indicates which buttons are pressed
> for all mouse events types.
> **Note:** Do not confuse this property with the {{domxref("MouseEvent.buttons")}} property, which indicates which buttons are pressed for all mouse events types.
## Syntax

```js
var buttonPressed = instanceOfMouseEvent.button
```

### Return value
## Value

A number representing a given button:

Expand All @@ -48,11 +34,10 @@ A number representing a given button:
- `3`: Fourth button, typically the _Browser Back_ button
- `4`: Fifth button, typically the _Browser Forward_ button

As noted above, buttons may be configured differently to the standard "left to right"
layout. A mouse configured for left-handed use may have the button actions reversed.
Some pointing devices only have one button and use keyboard or other input mechanisms to
indicate main, secondary, auxilary, etc. Others may have many buttons mapped to
different functions and button values.
As noted above, buttons may be configured differently to the standard "left to right" layout.
A mouse configured for left-handed use may have the button actions reversed.
Some pointing devices only have one button and use keyboard or other input mechanisms to indicate main, secondary, auxilary, etc.
Others may have many buttons mapped to different functions and button values.

## Example

Expand Down
56 changes: 19 additions & 37 deletions files/en-us/web/api/mouseevent/buttons/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,20 @@ browser-compat: api.MouseEvent.buttons
---
{{APIRef("DOM Events")}}

The **`MouseEvent.buttons`** read-only
property indicates which buttons are pressed on the mouse (or other input device)
when a mouse event is triggered.
The **`MouseEvent.buttons`** read-only property indicates which buttons are pressed on the mouse (or other input device) when a mouse event is triggered.

Each button that can be pressed is represented by a given number (see below). If more
than one button is pressed, the button values are added together to produce a new
number. For example, if the secondary (`2`) and auxilary (`4`)
buttons are pressed simultaneously, the value is `6` (i.e.,
`2 + 4`).
Each button that can be pressed is represented by a given number (see below).
If more than one button is pressed, the button values are added together to produce a new number.
For example, if the secondary (`2`) and auxilary (`4`) buttons are pressed simultaneously, the value is `6` (i.e., `2 + 4`).

> **Note:** Do not confuse this property with the
> {{domxref("MouseEvent.button")}} property. The {{domxref("MouseEvent.buttons")}}
> property indicates the state of buttons pressed during any kind of mouse event,
> while the {{domxref("MouseEvent.button")}} property only guarantees the correct
> value for mouse events caused by pressing or releasing one or multiple buttons.
> **Note:** Do not confuse this property with the {{domxref("MouseEvent.button")}} property.
> The {{domxref("MouseEvent.buttons")}} property indicates the state of buttons pressed during any kind of mouse event,
> while the {{domxref("MouseEvent.button")}} property only guarantees the correct value for mouse events caused by pressing or releasing one or multiple buttons.
## Syntax
## Value

```js
var buttonsPressed = instanceOfMouseEvent.buttons
```

### Return value

A number representing one or more buttons. For more than one button pressed
simultaneously, the values are combined (e.g., `3` is primary + secondary).
A number representing one or more buttons.
For more than one button pressed simultaneously, the values are combined (e.g., `3` is primary + secondary).

- `0`: No button or un-initialized
- `1`: Primary button (usually the left button)
Expand All @@ -50,8 +38,7 @@ simultaneously, the values are combined (e.g., `3` is primary + secondary).

## Example

This example logs the `buttons` property when you trigger a
{{Event("mousedown")}} event.
This example logs the `buttons` property when you trigger a {{Event("mousedown")}} event.

### HTML

Expand Down Expand Up @@ -93,19 +80,14 @@ document.querySelector('#log').appendChild(log)
Firefox supports the `buttons` attribute on Windows, Linux (GTK), and macOS
with the following restrictions:

- Utilities allow customization of button actions. Therefore, _primary_ might
not be the left button on the device, _secondary_ might not be the right
button, and so on. Moreover, the middle (wheel) button, 4th button, and 5th button
might not be assigned a value, even when they are pressed.
- Single-button devices may emulate additional buttons with combinations of button
and keyboard presses.
- Touch devices may emulate buttons with configurable gestures (e.g., one-finger
touch for _primary_, two-finger touch for _secondary_, etc.).
- On Linux (GTK), the 4th button and the 5th button are not supported. In addition,
a {{Event("mouseup")}} event always includes the releasing button information in
the `buttons` value.
- On Mac OS X 10.5, the `buttons` attribute always returns `0`
because there is no platform API for implementing this feature.
- Utilities allow customization of button actions.
Therefore, _primary_ might not be the left button on the device, _secondary_ might not be the right button, and so on.
Moreover, the middle (wheel) button, 4th button, and 5th button might not be assigned a value, even when they are pressed.
- Single-button devices may emulate additional buttons with combinations of button and keyboard presses.
- Touch devices may emulate buttons with configurable gestures (e.g., one-finger touch for _primary_, two-finger touch for _secondary_, etc.).
- On Linux (GTK), the 4th button and the 5th button are not supported.
In addition, a {{Event("mouseup")}} event always includes the releasing button information in the `buttons` value.
- On Mac OS X 10.5, the `buttons` attribute always returns `0` because there is no platform API for implementing this feature.

## See also

Expand Down
24 changes: 5 additions & 19 deletions files/en-us/web/api/mouseevent/clientx/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,17 @@ browser-compat: api.MouseEvent.clientX
---
{{APIRef("DOM Events")}}

The **`clientX`** read-only property of the
{{domxref("MouseEvent")}} interface provides the horizontal coordinate within the
application's {{glossary("viewport")}} at which the event occurred (as opposed to the
coordinate within the page).
The **`clientX`** read-only property of the {{domxref("MouseEvent")}} interface provides the horizontal coordinate within the application's {{glossary("viewport")}} at which the event occurred (as opposed to the coordinate within the page).

For example, clicking on the left edge of the viewport will always result in a mouse
event with a `clientX` value of `0`, regardless of whether the
page is scrolled horizontally.
For example, clicking on the left edge of the viewport will always result in a mouse event with a `clientX` value of `0`, regardless of whether the page is scrolled horizontally.

## Syntax
## Value

```js
var x = instanceOfMouseEvent.clientX
```

### Return value

A `double` floating point value, as redefined by the CSSOM View Module.
Originally, this property was defined as a `long` integer. See the "Browser
compatibility" section for details.
A `double` floating point value.

## Example

This example displays your mouse's coordinates whenever you trigger the
{{Event("mousemove")}} event.
This example displays your mouse's coordinates whenever you trigger the {{Event("mousemove")}} event.

### HTML

Expand Down
24 changes: 5 additions & 19 deletions files/en-us/web/api/mouseevent/clienty/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,17 @@ browser-compat: api.MouseEvent.clientY
---
{{APIRef("DOM Events")}}

The **`clientY`** read-only property of the
{{domxref("MouseEvent")}} interface provides the vertical coordinate within the
application's {{glossary("viewport")}} at which the event occurred (as opposed to the
coordinate within the page).
The **`clientY`** read-only property of the {{domxref("MouseEvent")}} interface provides the vertical coordinate within the application's {{glossary("viewport")}} at which the event occurred (as opposed to the coordinate within the page).

For example, clicking on the top edge of the viewport will always result in a mouse
event with a `clientY` value of `0`, regardless of whether the
page is scrolled vertically.
For example, clicking on the top edge of the viewport will always result in a mouse event with a `clientY` value of `0`, regardless of whether the page is scrolled vertically.

## Syntax
## Value

```js
var y = instanceOfMouseEvent.clientY
```

### Return value

A `double` floating point value, as redefined by the CSSOM View Module.
Originally, this property was defined as a `long` integer. See the "Browser
compatibility" section for details.
A `double` floating point value.

## Example

This example displays your mouse's coordinates whenever you trigger the
{{Event("mousemove")}} event.
This example displays your mouse's coordinates whenever you trigger the {{Event("mousemove")}} event.

### HTML

Expand Down
21 changes: 5 additions & 16 deletions files/en-us/web/api/mouseevent/ctrlkey/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,17 @@ browser-compat: api.MouseEvent.ctrlKey
---
{{APIRef("DOM Events")}}

The **`MouseEvent.ctrlKey`** read-only property is a
boolean value that indicates whether the <kbd>ctrl</kbd> key was pressed or not
when a given mouse event occurs.
The **`MouseEvent.ctrlKey`** read-only property is a boolean value that indicates whether the <kbd>ctrl</kbd> key was pressed or not when a given mouse event occurs.

> **Note:** On Macintosh keyboards, this key is the <kbd>control</kbd>
> key.
> **Note:** On Macintosh keyboards, this key is the <kbd>control</kbd> key.
## Syntax
## Value

```js
var ctrlKeyPressed = instanceOfMouseEvent.ctrlKey
```

### Return value

A boolean value, where `true` indicates that the key is pressed, and
`false` indicates that the key is _not_ pressed.
A boolean value, where `true` indicates that the key is pressed, and `false` indicates that the key is _not_ pressed.

## Example

This example logs the `ctrlKey` property when you trigger a
{{Event("click")}} event.
This example logs the `ctrlKey` property when you trigger a {{Event("click")}} event.

### HTML

Expand Down
15 changes: 6 additions & 9 deletions files/en-us/web/api/mouseevent/getmodifierstate/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@ browser-compat: api.MouseEvent.getModifierState
---
{{APIRef("DOM Events")}}

The **`MouseEvent.getModifierState()`** method returns the
current state of the specified modifier key: `true` if the modifier is active
(i.e., the modifier key is pressed or locked), otherwise, `false`.
The **`MouseEvent.getModifierState()`** method returns the current state of the specified modifier key: `true` if the modifier is active (i.e., the modifier key is pressed or locked), otherwise, `false`.

See the document of
{{domxref("KeyboardEvent.getModifierState","KeyboardEvent.getModifierState()")}} for
details.
See {{domxref("KeyboardEvent.getModifierState","KeyboardEvent.getModifierState()")}} for details.

## Syntax

```js
var active = event.getModifierState(keyArg);
getModifierState(keyArg)
```

### Returns 
Expand All @@ -34,8 +30,9 @@ A boolean value
### Parameters

- _`keyArg`_
- : A modifier key value. The value must be one of the {{domxref("KeyboardEvent.key")}}
values which represent modifier keys or `"Accel"`{{deprecated_inline}}. This is case-sensitive.
- : A modifier key value.
The value must be one of the {{domxref("KeyboardEvent.key")}} values which represent modifier keys or `"Accel"`{{deprecated_inline}}.
This is case-sensitive.

## Specifications

Expand Down
Loading

0 comments on commit d40315b

Please sign in to comment.