From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/html/global_attributes%2Fautofocus.html | 68 +++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 devdocs/html/global_attributes%2Fautofocus.html (limited to 'devdocs/html/global_attributes%2Fautofocus.html') diff --git a/devdocs/html/global_attributes%2Fautofocus.html b/devdocs/html/global_attributes%2Fautofocus.html new file mode 100644 index 00000000..e7b5c5b0 --- /dev/null +++ b/devdocs/html/global_attributes%2Fautofocus.html @@ -0,0 +1,68 @@ +

autofocus

+

The autofocus global attribute is a Boolean attribute indicating that an element should be focused on page load, or when the <dialog> that it is part of is displayed.

+

html

+
<input name="q" autofocus />
+
+

No more than one element in the document or dialog may have the autofocus attribute. If applied to multiple elements the first one will receive focus.

Note: The autofocus attribute applies to all elements, not just form controls. For example, it might be used on a contenteditable area.

+
+

Accessibility considerations

+
+

Automatically focusing a form control can confuse visually-impaired people using screen-reading technology and people with cognitive impairments. When autofocus is assigned, screen-readers "teleport" their user to the form control without warning them beforehand.

Use careful consideration for accessibility when applying the autofocus attribute. Automatically focusing on a control can cause the page to scroll on load. The focus can also cause dynamic keyboards to display on some touch devices. While a screen reader will announce the label of the form control receiving focus, the screen reader will not announce anything before the label, and the sighted user on a small device will equally miss the context created by the preceding content.

+
+

Specifications

+
+ + +
Specification
HTML Standard
# dom-fe-autofocus
+

Browser compatibility

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariWebView AndroidChrome AndroidFirefox for AndroidOpera AndroidSafari on IOSSamsung Internet
autofocus79
1–79Supported for the <button>, <input>, <select>, and <textarea> elements.
+
79
12–79Supported for the <button>, <input>, <select>, and <textarea> elements.
+
1Supported for the <button>, <input>, <select>, and <textarea> elements.
10Supported for the <button>, <input>, <select>, and <textarea> elements.
66
≤12.1–66Supported for the <button>, <input>, <select>, and <textarea> elements.
+
4Supported for the <button>, <input>, <select>, and <textarea> elements.
79
≤37–79Supported for the <button>, <input>, <select>, and <textarea> elements.
+
79
18–79Supported for the <button>, <input>, <select>, and <textarea> elements.
+
4Supported for the <button>, <input>, <select>, and <textarea> elements.
57
≤12.1–57Supported for the <button>, <input>, <select>, and <textarea> elements.
+
3.2Supported for the <button>, <input>, <select>, and <textarea> elements.
12.0
1.0–12.0Supported for the <button>, <input>, <select>, and <textarea> elements.
+
+

+ © 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
+ https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus +

+
-- cgit v1.2.3