From 0f019febf9849a083f2b80581798eb62696e137b Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 20 Dec 2016 14:46:33 -0500 Subject: [PATCH 1/3] Add the ability to not perform dialog focusing steps This closes #1929 by providing an opt-out for the use cases discussed there, via show({ skipFocusing: true }) and the same for showModal(). This was originally discussed in https://www.w3.org/Bugs/Public/show_bug.cgi?id=24718. --- source | 55 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/source b/source index 5b3f4055754..3d93ba5e764 100644 --- a/source +++ b/source @@ -56651,9 +56651,13 @@ dictionary RelatedEventInit : EventInit { interface HTMLDialogElement : HTMLElement { [CEReactions] attribute boolean open; attribute DOMString returnValue; - [CEReactions] void show(); - [CEReactions] void showModal(); + [CEReactions] void show(optional DialogShowOptions options); + [CEReactions] void showModal(optional DialogShowOptions options); [CEReactions] void close(optional DOMString returnValue); +}; + +dictionary DialogShowOptions { + boolean skipFocusing = false; }; @@ -56704,21 +56708,29 @@ interface HTMLDialogElement : HTMLElement {
-
dialog . show()
+
dialog . show( [ { skipFocusing: true } ] )

Displays the dialog element.

+

If the skipFocusing option is provided and set to true, then no additional automatic focusing logic will be performed. + Otherwise, the user agent will attempt to focus the contents of the dialog, taking + into account the autofocus attribute if relevant.

+
-
dialog . showModal()
+
dialog . showModal( [ { skipFocusing: true } ] )

Displays the dialog element and makes it the top-most modal dialog.

-

This method honors the autofocus attribute.

+

If the skipFocusing option is provided and set to true, then no additional automatic focusing logic will be performed. + Otherwise, the user agent will attempt to focus the contents of the dialog, taking + into account the autofocus attribute if relevant.

@@ -56748,20 +56760,22 @@ interface HTMLDialogElement : HTMLElement {
-

When the show() method is invoked, the user - agent must run the following steps:

+

When the show(options) method is + invoked, run the following steps:

    -
  1. If the element already has an open attribute, then - abort these steps.

  2. +
  3. If this dialog element already has an open attribute, then abort these steps.

  4. -
  5. Add an open attribute to the dialog +

  6. Add an open attribute to this dialog element, whose value is the empty string.

  7. -
  8. Set the dialog to the normal alignment mode.

  9. +
  10. Set this dialog to the normal alignment mode.

  11. -
  12. Run the dialog focusing steps for the dialog element.

  13. +
  14. If the skipFocusing member of options is not present, or + if it is present but its value is false, run the dialog focusing steps for this + dialog element.

@@ -56776,13 +56790,12 @@ interface HTMLDialogElement : HTMLElement { the pending dialog stack, it must be removed from the top layer.

-

When the showModal() method is invoked, - the user agent must run the following steps:

+

When the showModal(options) + method is invoked, the user agent must run the following steps:

    -
  1. Let subject be the dialog element on which the method was - invoked.

  2. +
  3. Let subject be this dialog element.

  4. If subject already has an open attribute, then throw an "InvalidStateError" DOMException @@ -56792,7 +56805,8 @@ interface HTMLDialogElement : HTMLElement { "InvalidStateError" DOMException and abort these steps.

  5. -
  6. Add an open attribute to subject, whose value is the empty string.

  7. +
  8. Add an open attribute to subject, whose + value is the empty string.

  9. Set the dialog to the centered alignment mode.

  10. @@ -56802,11 +56816,14 @@ interface HTMLDialogElement : HTMLElement {
  11. Push subject onto subject's node document's pending dialog stack.

  12. -
  13. Run the dialog focusing steps for subject.

  14. +
  15. If the skipFocusing member of options is not present, or + if it is present but its value is false, run the dialog focusing steps for + subject.

-

The dialog focusing steps for a dialog element subject are as follows:

+

The dialog focusing steps for a dialog element subject are + as follows:

    From cb3eaf652e8e406e12b7438b92b38ca764546707 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 21 Dec 2016 17:35:23 -0500 Subject: [PATCH 2/3] Rename to skipInitialFocus --- source | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/source b/source index 3d93ba5e764..63334fa622d 100644 --- a/source +++ b/source @@ -56657,7 +56657,7 @@ interface HTMLDialogElement : HTMLElement { }; dictionary DialogShowOptions { - boolean skipFocusing = false; + boolean skipInitialFocus = false; };
@@ -56708,29 +56708,31 @@ dictionary DialogShowOptions {
-
dialog . show( [ { skipFocusing: true } ] )
+
dialog . show( [ { skipInitialFocus: true } ] )

Displays the dialog element.

-

If the skipFocusing option is provided and set to true, then no additional automatic focusing logic will be performed. - Otherwise, the user agent will attempt to focus the contents of the dialog, taking - into account the autofocus attribute if relevant.

+

If the skipInitialFocus option is provided and set to true, then no + additional automatic focusing logic will be + performed. Otherwise, the user agent will attempt to focus the contents of the + dialog, taking into account the autofocus + attribute if relevant.

-
dialog . showModal( [ { skipFocusing: true } ] )
+
dialog . showModal( [ { skipInitialFocus: true } ] )

Displays the dialog element and makes it the top-most modal dialog.

-

If the skipFocusing option is provided and set to true, then no additional automatic focusing logic will be performed. - Otherwise, the user agent will attempt to focus the contents of the dialog, taking - into account the autofocus attribute if relevant.

+

If the skipInitialFocus option is provided and set to true, then no + additional automatic focusing logic will be + performed. Otherwise, the user agent will attempt to focus the contents of the + dialog, taking into account the autofocus + attribute if relevant.

@@ -56773,9 +56775,9 @@ dictionary DialogShowOptions {
  • Set this dialog to the normal alignment mode.

  • -
  • If the skipFocusing member of options is not present, or - if it is present but its value is false, run the dialog focusing steps for this - dialog element.

  • +
  • If the skipInitialFocusing member of options is not + present, or if it is present but its value is false, run the dialog focusing steps + for this dialog element.

  • @@ -56816,9 +56818,9 @@ dictionary DialogShowOptions {
  • Push subject onto subject's node document's pending dialog stack.

  • -
  • If the skipFocusing member of options is not present, or - if it is present but its value is false, run the dialog focusing steps for - subject.

  • +
  • If the skipInitialFocusing member of options is not + present, or if it is present but its value is false, run the dialog focusing steps + for subject.

  • From 16d19cdd7f812fd3e931720a3bd2db09d534407e Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 22 Dec 2016 14:14:27 -0500 Subject: [PATCH 3/3] Fix naming typos --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index 63334fa622d..781b0215fee 100644 --- a/source +++ b/source @@ -56775,7 +56775,7 @@ dictionary DialogShowOptions {
  • Set this dialog to the normal alignment mode.

  • -
  • If the skipInitialFocusing member of options is not +

  • If the skipInitialFocus member of options is not present, or if it is present but its value is false, run the dialog focusing steps for this dialog element.

  • @@ -56818,7 +56818,7 @@ dictionary DialogShowOptions {
  • Push subject onto subject's node document's pending dialog stack.

  • -
  • If the skipInitialFocusing member of options is not +

  • If the skipInitialFocus member of options is not present, or if it is present but its value is false, run the dialog focusing steps for subject.