Skip to content
Merged
Changes from 15 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
756ca9a
Translate "SyntheticEvent"
dmtrKovalenko Feb 13, 2019
76019fe
Make text simplier
dmtrKovalenko Feb 13, 2019
021f7c6
Fix ё letters
dmtrKovalenko Feb 14, 2019
5926c48
Update content/docs/reference-events.md
lex111 Feb 14, 2019
68673e6
Update content/docs/reference-events.md
angryermine Feb 14, 2019
9fa7bd5
Update content/docs/reference-events.md
angryermine Feb 14, 2019
63f292e
Update content/docs/reference-events.md
angryermine Feb 14, 2019
23ddc6f
Update content/docs/reference-events.md
angryermine Feb 14, 2019
00c0466
Update content/docs/reference-events.md
angryermine Feb 14, 2019
7ff16f1
Update content/docs/reference-events.md
angryermine Feb 14, 2019
91fc388
Update content/docs/reference-events.md
angryermine Feb 14, 2019
1a69ea3
Update content/docs/reference-events.md
angryermine Feb 14, 2019
005b348
Update content/docs/reference-events.md
lex111 Feb 14, 2019
27003fb
Update content/docs/reference-events.md
lex111 Feb 14, 2019
cca7599
Update content/docs/reference-events.md
lex111 Feb 14, 2019
dceef94
Update content/docs/reference-events.md
angryermine Feb 15, 2019
65a99e9
Update content/docs/reference-events.md
ntishkevich Feb 15, 2019
8c9b237
Translate event names
dmtrKovalenko Feb 21, 2019
653fde9
Update content/docs/reference-events.md
lex111 Feb 22, 2019
f1af3c1
Update content/docs/reference-events.md
lex111 Feb 22, 2019
d9df449
Update content/docs/reference-events.md
another-guy Feb 23, 2019
df96c0e
Update content/docs/reference-events.md
another-guy Feb 23, 2019
5be7fc0
Update content/docs/reference-events.md
another-guy Feb 23, 2019
802e74c
Update content/docs/reference-events.md
another-guy Feb 23, 2019
710e536
Update content/docs/reference-events.md
another-guy Feb 24, 2019
403286c
Update content/docs/reference-events.md
another-guy Feb 24, 2019
e64b8cd
Update content/docs/reference-events.md
another-guy Feb 24, 2019
49f631e
Update content/docs/reference-events.md
another-guy Feb 24, 2019
c34d134
Fix plural form of "Название"
dmtrKovalenko Feb 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 49 additions & 49 deletions content/docs/reference-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ layout: docs
category: Reference
---

This reference guide documents the `SyntheticEvent` wrapper that forms part of React's Event System. See the [Handling Events](/docs/handling-events.html) guide to learn more.
В этом справочном руководстве описана обёртка `SyntheticEvent`, которая является частью системы событий React. Смотрите руководство [Обработка событий](/docs/handling-events.html) для детальной информации.

## Overview {#overview}
## Беглый обзор {#overview}

Your event handlers will be passed instances of `SyntheticEvent`, a cross-browser wrapper around the browser's native event. It has the same interface as the browser's native event, including `stopPropagation()` and `preventDefault()`, except the events work identically across all browsers.
Ваши обработчики событий получают экземпляр `SyntheticEvent`, это кроссбраузерная обёртка над нативным экземпляром события. У нeё такой же интерфейс, как и у нативного события, включая методы `stopPropagation()` и `preventDefault()`, но такие события работают одинаково во всех браузерах.
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

If you find that you need the underlying browser event for some reason, simply use the `nativeEvent` attribute to get it. Every `SyntheticEvent` object has the following attributes:
Если все-таки вам нужно получить нативное браузерное событие, просто обратитесь к атрибуту `nativeEvent`. Помимо него каждый объект `SyntheticEvent` содержит следующие атрибуты:
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

```javascript
boolean bubbles
Expand All @@ -31,15 +31,15 @@ number timeStamp
string type
```

> Note:
> Примечание:
>
> As of v0.14, returning `false` from an event handler will no longer stop event propagation. Instead, `e.stopPropagation()` or `e.preventDefault()` should be triggered manually, as appropriate.
> Начиная с версии 0.14, возврат `false` из обработчика событий больше не останавливает всплытие. Вместо этого, `e.stopPropagation()` или `e.preventDefault()` нужно вызывать вручную, если это необходимо.
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

### Event Pooling {#event-pooling}
### Делегирование событий {#event-pooling}
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

The `SyntheticEvent` is pooled. This means that the `SyntheticEvent` object will be reused and all properties will be nullified after the event callback has been invoked.
This is for performance reasons.
As such, you cannot access the event in an asynchronous way.
`SyntheticEvent` является делегированным. Это означает, что объект `SyntheticEvent` будет переиспользован, а все свойства будут обнулены после окончания выполнения обработчика.
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated
Это необходимо из соображений производительности.
Именно поэтому нельзя использовать синтетические события асинхронно.

```javascript
function onClick(event) {
Expand All @@ -60,15 +60,15 @@ function onClick(event) {
}
```

> Note:
> На заметку:
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated
>
> If you want to access the event properties in an asynchronous way, you should call `event.persist()` on the event, which will remove the synthetic event from the pool and allow references to the event to be retained by user code.
> Если вы всё же хотите обратиться к полям события асинхронно, вам нужно вызвать `event.persist()` на событии. Это отключит делегирование этого обьекта и позволит обращаться к нему в дальнейшем.
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

## Supported Events {#supported-events}
## Поддерживаемые события {#supported-events}

React normalizes events so that they have consistent properties across different browsers.
React нормализует события так, чтобы они содержали одинаковые свойства во всех бразурах.

The event handlers below are triggered by an event in the bubbling phase. To register an event handler for the capture phase, append `Capture` to the event name; for example, instead of using `onClick`, you would use `onClickCapture` to handle the click event in the capture phase.
Обработчики ниже вызываются на фазе всплытия (bubbling). А чтобы зарегистрировать событие на фазе перехвата (capture), просто добавьте `Capture` к имени события; например, вместо использования `onClick` используйте `onClickCapture`, чтобы обработать событие на фазе перехвата.

- [Clipboard Events](#clipboard-events)
Comment thread
lex111 marked this conversation as resolved.
Outdated
- [Composition Events](#composition-events)
Expand All @@ -93,13 +93,13 @@ The event handlers below are triggered by an event in the bubbling phase. To reg

### Clipboard Events {#clipboard-events}

Event names:
Название событий:
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

```
onCopy onCut onPaste
```

Properties:
Свойства:

```javascript
DOMDataTransfer clipboardData
Expand All @@ -109,13 +109,13 @@ DOMDataTransfer clipboardData

### Composition Events {#composition-events}

Event names:
Название событий:

```
onCompositionEnd onCompositionStart onCompositionUpdate
```

Properties:
Свойства:

```javascript
string data
Expand All @@ -126,13 +126,13 @@ string data

### Keyboard Events {#keyboard-events}

Event names:
Название событий:

```
onKeyDown onKeyPress onKeyUp
```

Properties:
Свойства:

```javascript
boolean altKey
Expand All @@ -149,21 +149,21 @@ boolean shiftKey
number which
```

The `key` property can take any of the values documented in the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values).
Свойство `key` может содержать любое из документированных в [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values) значений.

* * *

### Focus Events {#focus-events}

Event names:
Название событий:

```
onFocus onBlur
```

These focus events work on all elements in the React DOM, not just form elements.
Эти события фокуса работают не только на элементах формы, но и на всех остальных элементах в React DOM.

Properties:
Свойства:

```javascript
DOMEventTarget relatedTarget
Expand All @@ -173,29 +173,29 @@ DOMEventTarget relatedTarget

### Form Events {#form-events}

Event names:
Название событий:

```
onChange onInput onInvalid onSubmit
```

For more information about the onChange event, see [Forms](/docs/forms.html).
Больше информации о событии onChange тут — [Forms](/docs/forms.html).

* * *

### Mouse Events {#mouse-events}

Event names:
Название событий:

```
onClick onContextMenu onDoubleClick onDrag onDragEnd onDragEnter onDragExit
onDragLeave onDragOver onDragStart onDrop onMouseDown onMouseEnter onMouseLeave
onMouseMove onMouseOut onMouseOver onMouseUp
```

The `onMouseEnter` and `onMouseLeave` events propagate from the element being left to the one being entered instead of ordinary bubbling and do not have a capture phase.
События `onMouseEnter` и `onMouseLeave` всплывают с покинутого элемента к наведенному, вместо обычного процесса всплытия и не имеют фазы перехвата.
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

Properties:
Свойства:

```javascript
boolean altKey
Expand All @@ -218,18 +218,18 @@ boolean shiftKey

### Pointer Events {#pointer-events}

Event names:
Название собыий:
Comment thread
dmtrKovalenko marked this conversation as resolved.

```
onPointerDown onPointerMove onPointerUp onPointerCancel onGotPointerCapture
onLostPointerCapture onPointerEnter onPointerLeave onPointerOver onPointerOut
```

The `onPointerEnter` and `onPointerLeave` events propagate from the element being left to the one being entered instead of ordinary bubbling and do not have a capture phase.
События `onPointerEnter` и `onPointerLeave` всплывают с покинутого элемента к наведенному, вместо обычного процесса всплытия и не имеют фазы перехвата.
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

Properties:
Свойства:

As defined in the [W3 spec](https://www.w3.org/TR/pointerevents/), pointer events extend [Mouse Events](#mouse-events) with the following properties:
По определению из [W3 spec](https://www.w3.org/TR/pointerevents/), события курсора наследуют [Mouse Events](#mouse-events) со следующими свойствами:

```javascript
number pointerId
Expand All @@ -244,17 +244,17 @@ string pointerType
boolean isPrimary
```

A note on cross-browser support:
На заметку по поводу кросс-браузерности:
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

Pointer events are not yet supported in every browser (at the time of writing this article, supported browsers include: Chrome, Firefox, Edge, and Internet Explorer). React deliberately does not polyfill support for other browsers because a standard-conform polyfill would significantly increase the bundle size of `react-dom`.
События указателя ещё не поддерживаются во всех браузерах (на момент написания этой статьи поддерживают браузеры: Chrome, Firefox, Edge, и Internet Explorer). React сознательно не полифилит поддержку в других браузерах потому что это значительно бы увеличило размер `react-dom`.
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

If your application requires pointer events, we recommend adding a third party pointer event polyfill.
Если вашему приложению нужны события указателя, мы рекомендуем использовать сторонний полифилл.
Comment thread
dmtrKovalenko marked this conversation as resolved.
Outdated

* * *

### Selection Events {#selection-events}

Event names:
Название событий:

```
onSelect
Expand All @@ -264,13 +264,13 @@ onSelect

### Touch Events {#touch-events}

Event names:
Название событий:

```
onTouchCancel onTouchEnd onTouchMove onTouchStart
```

Properties:
Свойства:

```javascript
boolean altKey
Expand All @@ -287,7 +287,7 @@ DOMTouchList touches

### UI Events {#ui-events}

Event names:
Название событий:

```
onScroll
Expand All @@ -310,7 +310,7 @@ Event names:
onWheel
```

Properties:
Свойства:

```javascript
number deltaMode
Expand All @@ -323,7 +323,7 @@ number deltaZ

### Media Events {#media-events}

Event names:
Название событий:

```
onAbort onCanPlay onCanPlayThrough onDurationChange onEmptied onEncrypted
Expand All @@ -336,7 +336,7 @@ onTimeUpdate onVolumeChange onWaiting

### Image Events {#image-events}

Event names:
Название событий:

```
onLoad onError
Expand All @@ -346,13 +346,13 @@ onLoad onError

### Animation Events {#animation-events}

Event names:
Название событий:

```
onAnimationStart onAnimationEnd onAnimationIteration
```

Properties:
Свойства:

```javascript
string animationName
Expand All @@ -364,13 +364,13 @@ float elapsedTime

### Transition Events {#transition-events}

Event names:
Название событий:

```
onTransitionEnd
```

Properties:
Свойства:

```javascript
string propertyName
Expand All @@ -382,7 +382,7 @@ float elapsedTime

### Other Events {#other-events}

Event names:
Название событий:

```
onToggle
Expand Down