From 0b68a189a20094c6a44a4b09e1b7610d59e7f3ef Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Mon, 2 Dec 2019 13:16:13 +0900 Subject: [PATCH 1/6] ElementInternals: Add a capability to set the default focus bahvior This commit introduces 'focusBehavior' IDL attribute of ElementInternals interface. It accepts "unfocusable", "focusable", and "simple-control", and affects focus behavior of ElementInternals' target element. This fixes w3c/webcomponents#762 --- source | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/source b/source index 1df0a0cc4b4..5e59114cacc 100644 --- a/source +++ b/source @@ -68057,6 +68057,9 @@ interface ElementInternals { boolean reportValidity(); readonly attribute NodeList labels; + + // Focus management + attribute DOMString focusBehavior; }; dictionary ValidityStateFlags { @@ -68145,6 +68148,18 @@ dictionary ValidityStateFlags { internals's target element is associated with.

+
internals . focusBehavior + [ = value ]
+
+

Returns the focus behavior of the + internals's target element. Possible values + are "unfocusable", "focusable", and + "simple-control". If an unknown value was set, this returns + "focusable".

+ +

Can be set, to change the focus behavior to the new + value.

+

Each ElementInternals has a target element, @@ -68352,6 +68367,34 @@ dictionary ValidityStateFlags { submission value.

+

Each autonomous custom element has + focus behavior string, initially + "unfocusable", which indicates the element is not focusable. + There are two other values; "focusable" and + "simple-control". Both of them indicate the element is + focusable. + +

Differences between "focusable" and + "simple-control" depend on the user agent. + "focusable" indicates the element's sequentially focusable and + click focusable behavior is same as a general element such as + <div tabindex="0">. "simple-control" indicates + the element's sequentially focusable and click focusable behavior is + same as a simple control like a button element.

+ +

The focusBehavior IDL + attribute must return focus behavior of the + target element. On setting, if the new string is one of + "unfocusable", "focusable", and + "simple-control", then the + focus behavior of the + target element must be set to the string, and otherwise it + must be set to "focusable".

+ +

Setting focusBehavior to + an unknown keyword does not throw because new keywords might be added in the future, and user + agents without the new keyword support have to work somehow with documents using the new + keyword.

Common idioms without dedicated elements

@@ -73911,6 +73954,10 @@ END:VCARD
  • Editing hosts
  • Browsing context containers
  • + +
  • >Autonomous custom elements of which + focus behavior is not + "unfocusable". From 69351e4224a448b0ee697c96d6e3d17799eeef04 Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Tue, 3 Dec 2019 17:46:30 +0900 Subject: [PATCH 2/6] Remove unnecessary '>' --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index 5e59114cacc..90df6101989 100644 --- a/source +++ b/source @@ -73955,7 +73955,7 @@ END:VCARD
  • Browsing context containers
  • -
  • >Autonomous custom elements of which +
  • Autonomous custom elements of which focus behavior is not "unfocusable". From 3286a58ab63898c8be0b173c5bcc2b3288875340 Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Tue, 3 Dec 2019 21:03:49 +0900 Subject: [PATCH 3/6] Mention :focus-visible --- source | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/source b/source index 90df6101989..63b2114517e 100644 --- a/source +++ b/source @@ -3866,6 +3866,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • type selector
  • attribute selector
  • pseudo-class
  • +
  • :focus-visible
  • The following features are defined in CSS Values and Units: ValidityStateFlags { "simple-control". Both of them indicate the element is focusable. -

    Differences between "focusable" and - "simple-control" depend on the user agent. - "focusable" indicates the element's sequentially focusable and - click focusable behavior is same as a general element such as - <div tabindex="0">. "simple-control" indicates - the element's sequentially focusable and click focusable behavior is - same as a simple control like a button element.

    +

    "focusable" indicates the element's focus-related behavior + is same as a general element such as <div tabindex="0">. + "simple-control" indicates the element's focus-related behavior is same as + a simple control like a button element. + Behavior differences between "focusable" and + "simple-control" depend on the user agent. They might affect + sequentially focusable, click focusable, and + :focus-visible pseudo-class.

    The focusBehavior IDL attribute must return focus behavior of the From 9011d817e52d5b9484a6ab5d6e288075af568916 Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Wed, 4 Dec 2019 18:02:05 +0900 Subject: [PATCH 4/6] unfocusable -> default --- source | 50 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/source b/source index 63b2114517e..ccfeab25794 100644 --- a/source +++ b/source @@ -68155,7 +68155,7 @@ dictionary ValidityStateFlags {

    Returns the focus behavior of the internals's target element. Possible values - are "unfocusable", "focusable", and + are "default", "focusable", and "simple-control". If an unknown value was set, this returns "focusable".

    @@ -68371,24 +68371,42 @@ dictionary ValidityStateFlags {

    Each autonomous custom element has focus behavior string, initially - "unfocusable", which indicates the element is not focusable. - There are two other values; "focusable" and - "simple-control". Both of them indicate the element is - focusable. - -

    "focusable" indicates the element's focus-related behavior - is same as a general element such as <div tabindex="0">. - "simple-control" indicates the element's focus-related behavior is same as - a simple control like a button element. - Behavior differences between "focusable" and - "simple-control" depend on the user agent. They might affect - sequentially focusable, click focusable, and - :focus-visible pseudo-class.

    + "default". It also can be "focusable" or + "simple-control".

    + +
    +
    default
    +
    +

    The element is not focusable by default. The element's focus-related behavior + is same as elements like div, which is not focusable by default.

    + +

    Authors can make the element with "default" + focus behavior focusable with some ways. + For example, adding tabindex content attribute or + contanteditable content attribute.

    +
    + +
    focusable
    +

    The element is focusable by default. The element's focus-related behavior is + same as general focusable elements such as editing host.

    + +
    simple-control
    +
    +

    The element is focusable by default. The element's focus-related behavior is + same as simple controls like a button element.

    + +

    Behavior differences between "focusable" and + "simple-control" depend on the user agent. They might affect + sequentially focusable, click focusable, and + :focus-visible pseudo-class.

    +
    +
    +

    The focusBehavior IDL attribute must return focus behavior of the target element. On setting, if the new string is one of - "unfocusable", "focusable", and + "default", "focusable", and "simple-control", then the focus behavior of the target element must be set to the string, and otherwise it @@ -73960,7 +73978,7 @@ END:VCARD

  • Autonomous custom elements of which focus behavior is not - "unfocusable". + "default".
  • From 30e04319cdf53cf1c749244b7708cfa99614aeaf Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 18 Dec 2019 14:22:35 -0500 Subject: [PATCH 5/6] Editorial tweaks --- source | 76 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/source b/source index ccfeab25794..78b343d7ca9 100644 --- a/source +++ b/source @@ -68155,9 +68155,10 @@ dictionary ValidityStateFlags {

    Returns the focus behavior of the internals's target element. Possible values - are "default", "focusable", and - "simple-control". If an unknown value was set, this returns - "focusable".

    + are "default", "focusable", and "simple-control". If an unknown value was set, + this returns "focusable".

    Can be set, to change the focus behavior to the new value.

    @@ -68369,53 +68370,60 @@ dictionary ValidityStateFlags { submission value.

    -

    Each autonomous custom element has - focus behavior string, initially - "default". It also can be "focusable" or - "simple-control".

    +
    + +

    Each autonomous custom element has focus + behavior string, initially "default". It also + can be "focusable" or "simple-control". These values have the following + impacts:

    -
    default
    +
    "default"

    The element is not focusable by default. The element's focus-related behavior - is same as elements like div, which is not focusable by default.

    + is same as elements like div, which are not focusable by default.

    -

    Authors can make the element with "default" - focus behavior focusable with some ways. - For example, adding tabindex content attribute or - contanteditable content attribute.

    +

    There are ways for authors to make an element with "default" focus + behavior focusable, e.g., adding a tabindex or contenteditable content attribute.

    -
    focusable
    +
    "focusable"

    The element is focusable by default. The element's focus-related behavior is - same as general focusable elements such as editing host.

    + same as general focusable elements such as editing + hosts.

    -
    simple-control
    +
    "simple-control"

    The element is focusable by default. The element's focus-related behavior is - same as simple controls like a button element.

    + same as simple controls like button elements.

    -

    Behavior differences between "focusable" and - "simple-control" depend on the user agent. They might affect - sequentially focusable, click focusable, and - :focus-visible pseudo-class.

    +

    Behavior differences between "focusable" and "simple-control" depend on the user agent. They + might affect sequential focusability, click focusability, or the :focus-visible pseudo-class.

    The focusBehavior IDL - attribute must return focus behavior of the - target element. On setting, if the new string is one of - "default", "focusable", and - "simple-control", then the - focus behavior of the - target element must be set to the string, and otherwise it - must be set to "focusable".

    + attribute, on getting, must return the focus behavior of + this ElementInternals's target element. On + setting, if the new string is one of "default", + "focusable", or "simple-control", then set the focus behavior of this ElementInternals's target element to the given value. Otherwise, set it to "focusable".

    Setting focusBehavior to - an unknown keyword does not throw because new keywords might be added in the future, and user - agents without the new keyword support have to work somehow with documents using the new - keyword.

    + an unknown value does not throw because new values might be added in the future, and user agents + without support for the new value have to work somehow with documents using the new keyword.

    Common idioms without dedicated elements

    @@ -73976,9 +73984,9 @@ END:VCARD
  • Browsing context containers
  • -
  • Autonomous custom elements of which - focus behavior is not - "default".
  • +
  • Autonomous custom elements whose focus behavior is not "default".
  • From 9f97df58da604449bfa3b47c410e728e22ddd9b3 Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Thu, 26 Dec 2019 17:26:24 +0900 Subject: [PATCH 6/6] - Add a reference to null tabindex from the table - Add a paragraph next to the click focusable definition --- source | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source b/source index 78b343d7ca9..06a1ef7b01e 100644 --- a/source +++ b/source @@ -73538,8 +73538,13 @@ END:VCARD Elements that meet all the following criteria:
      -
    • the element's tabindex value is a non-negative integer, or the element is - determined by the user agent to be focusable;
    • +
    • +

      the element's tabindex value is a non-negative integer, or the element is + determined by the user agent to be focusable;

      + +

      See the description of null tabindex value for the + latter case.

      +
    • the element is either not a shadow host, or has a shadow root whose delegates focus is @@ -73738,6 +73743,11 @@ END:VCARD
    +

    For focusable areas that are + autonomous custom elements, user agents should + consider the element's focus behavior in determining + whether the element is click focusable or sequentially focusable.

    +

    Elements which are not focusable are not focusable areas, and thus not sequentially focusable and not click focusable.

    @@ -73936,7 +73946,7 @@ END:VCARD
    -
    If the value is null
    +
    If the value is null