Skip to content

[과제번역] Part2. 4.4 Form submission: event and method submit 과제 번역 #1122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
A modal window can be implemented using a half-transparent `<div id="cover-div">` that covers the whole window, like this:
모달 창은 다음과 같이 전체 창을 덮는 반투명 `<div id="cover-div">`를 사용하여 구현할 수 있습니다.

```css
#cover-div {
Expand All @@ -13,8 +13,8 @@ A modal window can be implemented using a half-transparent `<div id="cover-div">
}
```

Because the `<div>` covers everything, it gets all clicks, not the page below it.
`<div>`가 창 전체를 덮기 때문에 아래에 있는 페이지가 아닌 `<div>`가 클릭 됩니다.

Also we can prevent page scroll by setting `body.style.overflowY='hidden'`.
또한 `body.style.overflowY='hidden'`을 설정하여 페이지 스크롤을 방지할 수 있습니다.

The form should be not in the `<div>`, but next to it, because we don't want it to have `opacity`.
폼이 투명해지는 것을 원치 않기 때문에 `<div>`의 내부가 아닌 옆에 위치해야 합니다.
26 changes: 13 additions & 13 deletions 2-ui/4-forms-controls/4-forms-submit/1-modal-dialog/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ importance: 5

---

# Modal form
# 모달 폼 (Modal Form)

Create a function `showPrompt(html, callback)` that shows a form with the message `html`, an input field and buttons `OK/CANCEL`.
메시지 `html`, 입력 필드(input field), 확인(OK) 및 취소(Cancel) 버튼을 갖춘 폼을 나타내는 함수 `showPrompt(html, callback)`을 생성하세요.

- A user should type something into a text field and press `key:Enter` or the OK button, then `callback(value)` is called with the value they entered.
- Otherwise if the user presses `key:Esc` or CANCEL, then `callback(null)` is called.
- 사용자가 텍스트 필드에 무언가를 입력하고 `key:Enter` 혹은 OK 버튼을 누르면 입력한 값으로 `callback(value)`이 호출됩니다.
- 반면에 사용자가 `ESC`키나 취소(Cancel) 버튼을 누르면 `callback(null)`이 호출됩니다.

In both cases that ends the input process and removes the form.
두 경우 모두 입력 프로세스가 종료하고 양식을 제거합니다.

Requirements:
요구 사항:

- The form should be in the center of the window.
- The form is *modal*. In other words, no interaction with the rest of the page is possible until the user closes it.
- When the form is shown, the focus should be inside the `<input>` for the user.
- Keys `key:Tab`/`key:Shift+Tab` should shift the focus between form fields, don't allow it to leave for other page elements.
- 폼은 창 중앙에 있어야 합니다.
- 폼은 '모달'이므로 사용자가 폼을 닫을 때까지 페이지의 나머지 부분과 상호 작용이 불가능합니다.
- 폼이 표시될 때 사용자의 `<input>` 내부에 포커스가 있어야 합니다.
- `Tab`키, `Shift+Tab`키는 폼 필드 내에서만 포커스를 이동할 수 있어야 하며, 페이지의 다른 요소로는 이동하지 않아야 합니다.

Usage example:
사용 예:

```js
showPrompt("Enter something<br>...smart :)", function(value) {
alert(value);
});
```

A demo in the iframe:
iframe 데모입니다.

[iframe src="solution" height=160 border=1]

P.S. The source document has HTML/CSS for the form with fixed positioning, but it's up to you to make it modal.
참고: 원본 문서에는 `position: fixed;`로 정의한 폼에 대한 HTML·CSS가 있지만 모달을 만드는 것은 사용자의 몫입니다.