Skip to content

Commit efb2a25

Browse files
author
Gusgotoyu365
committed
[과제 번역] focus와 blur 과제, Keyboard-driven mouse 해답 번역 (#1096)
1 parent fc516c7 commit efb2a25

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
We can use `mouse.onclick` to handle the click and make the mouse "moveable" with `position:fixed`, then `mouse.onkeydown` to handle arrow keys.
2+
`mouse.onclick`으로 클릭 이벤트를 핸들링하고 `position:fixed`로 쥐가 이동할 수 있도록 준비합니다. 이 상태에서 `mouse.onkeydown`로 화살표 키를 핸들링합니다.
33

4-
The only pitfall is that `keydown` only triggers on elements with focus. So we need to add `tabindex` to the element. As we're forbidden to change HTML, we can use `mouse.tabIndex` property for that.
4+
문제의 핵심은 `keydown`은 오직 포커스된 요소에서만 트리거 된다는 점입니다. 따라서 원하는 요구사항을 구현하려면 요소에 `tabindex`를 추가해줘야 합니다. 그런데 문제에서 HTML을 수정하지 말라고 했으므로 속성값 추가 말고 `mouse.tabIndex` 프로퍼티를 사용해야 합니다.
55

6-
P.S. We also can replace `mouse.onclick` with `mouse.onfocus`.
6+
참고: 해답에서 `mouse.onclick``mouse.onfocus`로 바꿔도 잘 동작합니다.

2-ui/4-forms-controls/2-focus-blur/5-keyboard-mouse/solution.view/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<body>
2020

21-
<p>Click on the mouse and move it with arrow keys.</p>
21+
<p>쥐를 클릭하고 화살표 키를 눌러 쥐를 움직여 보세요.</p>
2222

2323
<pre id="mouse">
2424
_ _

0 commit comments

Comments
 (0)