You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The`onFocus`event is called when the element (or some element inside of it) receives focus. For example, it's called when the user clicks on a text input.
157
+
Az`onFocus`esemény akkor van meghívva, amikor az elem (vagy valamelyik elem azon belül) fókuszálva van. Például amikor a felhasználó egy szöveg beivteli mezőre kattint.
158
158
159
159
```javascript
160
160
functionExample() {
161
161
return (
162
162
<input
163
163
onFocus={(e) => {
164
-
console.log('Focused on input');
164
+
console.log('Fókuszálva a beviteli mezőre');
165
165
}}
166
-
placeholder="onFocus is triggered when you click this input."
166
+
placeholder="Az onFocus meg lesz hívva, ha erre a beviteli mezőre kattintasz."
167
167
/>
168
168
)
169
169
}
170
170
```
171
171
172
172
#### onBlur
173
173
174
-
The`onBlur`event handler is called when focus has left the element (or left some element inside of it). For example, it's called when the user clicks outside of a focused text input.
174
+
Az`onBlur`esemény akkor van meghívva, amikor a fókuszálás elhagyta az elemet (vagy valamelyik elemet azon belül). Például akkor, amikor a felhasználó egy fókuszált szöveg beviteli mezőn kívülre kattint.
175
175
176
176
```javascript
177
177
functionExample() {
178
178
return (
179
179
<input
180
180
onBlur={(e) => {
181
-
console.log('Triggered because this input lost focus');
181
+
console.log('Meghívva, mivel a beviteli mező elvesztette a fókuszt');
182
182
}}
183
-
placeholder="onBlur is triggered when you click this input and then you click outside of it."
183
+
placeholder="Az onBlur meg lesz hívva, ha erre a beviteli mezőre kattintasz, majd utána ezen kívülre."
184
184
/>
185
185
)
186
186
}
187
187
```
188
188
189
-
#### Detecting Focus Entering and Leaving
189
+
#### Fókuszálás és fókuszálás elvesztésének detektálása
190
190
191
191
You can use the `currentTarget` and `relatedTarget` to differentiate if the focusing or blurring events originated from _outside_ of the parent element. Here is a demo you can copy and paste that shows how to detect focusing a child, focusing the element itself, and focus entering or leaving the whole subtree.
192
+
Használhatod a `currentTarget` és `releatedTarget`-et, hogy meg tudd különböztetni, hogy a fókuszálás vagy fókuszálás elvesztésének eseménye a szülő komponensen _kívülről_ jön-e. Itt egy demo amit kimásolhatsz és beilleszthetsz, ami megmutatja hogyan detektálj fókuszálást egy gyermek elemre, magára az elemre, és fókuszálást vagy fókuszálás elvesztést a teljes alfára.
192
193
193
194
```javascript
194
195
functionExample() {
@@ -197,24 +198,24 @@ function Example() {
197
198
tabIndex={1}
198
199
onFocus={(e) => {
199
200
if (e.currentTarget===e.target) {
200
-
console.log('focused self');
201
+
console.log('saját magára fókuszált');
201
202
} else {
202
-
console.log('focused child', e.target);
203
+
console.log('gyermekre fókuszált', e.target);
203
204
}
204
205
if (!e.currentTarget.contains(e.relatedTarget)) {
205
-
//Not triggered when swapping focus between children
206
-
console.log('focus entered self');
206
+
//Nincs meghívva gyermekek közti fókuszálás csere közt
207
+
console.log('fókusz belépés saját magára');
207
208
}
208
209
}}
209
210
onBlur={(e) => {
210
211
if (e.currentTarget===e.target) {
211
-
console.log('unfocused self');
212
+
console.log('saját maga fókuszálásának elvesztése');
0 commit comments