From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- files/ko/web/html/element/dialog/index.html | 180 ++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 files/ko/web/html/element/dialog/index.html (limited to 'files/ko/web/html/element/dialog') diff --git a/files/ko/web/html/element/dialog/index.html b/files/ko/web/html/element/dialog/index.html new file mode 100644 index 0000000000..d54f8e313f --- /dev/null +++ b/files/ko/web/html/element/dialog/index.html @@ -0,0 +1,180 @@ +--- +title: ': 대화 상자 요소' +slug: Web/HTML/Element/dialog +tags: + - Element + - HTML + - HTML interactive elements + - Reference + - Web + - polyfill + - 대화 상자 +translation_of: Web/HTML/Element/dialog +--- +
{{HTMLRef}}
+ +

HTML <dialog> 요소는 닫을 수 있는 경고, 검사기, 창 등 대화 상자 및 기타 다른 상호작용 가능한 컴포넌트를 나타냅니다.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
콘텐츠 카테고리플로우 콘텐츠, 구획 루트.
가능한 콘텐츠플로우 콘텐츠.
태그 생략{{no_tag_omission}}
가능한 부모 요소플로우 콘텐츠를 허용하는 모든 요소.
암시적 ARIA 역할dialog
가능한 ARIA 역할{{ARIARole("alertdialog")}}
DOM 인터페이스{{domxref("HTMLDialogElement")}}
+ +

특성

+ +

이 요소는 전역 특성을 포함합니다.

+ +
+

tabindex 특성을 <dialog> 요소에 사용해서는 안됩니다.

+
+ +
+
{{htmlattrdef("open")}}
+
대화 상자가 활성 상태이며 상호작용할 수 있음을 나타냅니다. open 특성이 없을 때 대화 상자가 사용자에게 보여서는 안됩니다.
+
+ +

사용 일람

+ + + +

예제

+ +

간단한 예제

+ +
<dialog open>
+  <p>여러분 안녕하세요!</p>
+</dialog>
+
+ +

고급 예제

+ +

다음 예제는 "상세정보 업데이트" 버튼을 클릭할 경우 양식을 포함한 팝업 대화 상자를 엽니다.

+ +

HTML

+ +
<!-- 간단한 양식을 포함한 팝업 대화 상자 -->
+<dialog id="favDialog">
+  <form method="dialog">
+    <p><label>좋아하는 동물:
+      <select>
+        <option></option>
+        <option>아르테미아</option>
+        <option>레서판다</option>
+        <option>거미원숭이</option>
+      </select>
+    </label></p>
+    <menu>
+      <button value="cancel">취소</button>
+      <button id="confirmBtn" value="default">확인</button>
+    </menu>
+  </form>
+</dialog>
+
+<menu>
+  <button id="updateDetails">상세정보 업데이트</button>
+</menu>
+
+<output aria-live="polite"></output>
+ +

JavaScript

+ +
var updateButton = document.getElementById('updateDetails');
+var favDialog = document.getElementById('favDialog');
+var outputBox = document.getElementsByTagName('output')[0];
+var selectEl = document.getElementsByTagName('select')[0];
+var confirmBtn = document.getElementById('confirmBtn');
+
+// “Update details” button opens the <dialog> modally
+updateButton.addEventListener('click', function onOpen() {
+  if (typeof favDialog.showModal === "function") {
+    favDialog.showModal();
+  } else {
+    alert("The <dialog> API is not supported by this browser");
+  }
+});
+// "Favorite animal" input sets the value of the submit button
+selectEl.addEventListener('change', function onSelect(e) {
+  confirmBtn.value = selectEl.value;
+});
+// "Confirm" button of form triggers "close" on dialog because of [method="dialog"]
+favDialog.addEventListener('close', function onClose() {
+  outputBox.value = favDialog.returnValue + " button clicked - " + (new Date()).toString();
+});
+ +

결과

+ +

{{EmbedLiveSample("고급_예제", "100%", 300)}}

+ +

명세

+ + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'forms.html#the-dialog-element', '<dialog>')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5.1', 'interactive-elements.html#the-dialog-element', '<dialog>')}}{{Spec2('HTML5.1')}}최초 정의
+ +

브라우저 호환성

+ + + +

{{Compat("html.elements.dialog")}}

+ +

폴리필

+ +

지원하지 않는 브라우저에서 <dialog>를 사용하려면 dialog-polyfill을 추가하세요.

+ +

같이 보기

+ + -- cgit v1.2.3-54-g00ecf