When opening a dialog through .openModal() the first focusable (yes, even [tabindex="-1"]) gets focus, unless a form element has [autofocus]. Positive tabindex ([tabindex="1"]) is prepended to the tab-order, making it accessible directly through Shift + Tab or after a full loop through the browser chrome (address bar, etc.). If the first focusable DOM element has a positive tabindex ([tabindex="3"]), the tabbing-sequence is entered at that point, continuing with [tabindex="4"] on Tab and going back to [tabindex="2"] on Shift Tab. While opening the dialog [autofocus] is respected, it is ignored upon the document gaining focus again, after focus was on browser UI. In this case, the tabbing sequence starts with [tabindex="1"] if available, otherwise with the first focusable DOM element.

Note: it is not possible to focus the browser chrome from script.

Note: <dialog> is currently only supported by Blink.

focusable