-
Notifications
You must be signed in to change notification settings - Fork 23.2k
SVG autofocus attribute: missing but widely available #41576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ca4a66c
SVG autofocus attribute: missing but widely available
estelle 405d4fc
SVG autofocus attribute: missing but widely available
estelle 33b3b1b
Apply suggestions from code review
estelle fd4fae3
Update files/en-us/web/svg/reference/attribute/autofocus/index.md
estelle a2c5cee
Update files/en-us/web/svg/reference/attribute/autofocus/index.md
estelle 3f9ad74
Merge branch 'main' into svgautofocus
estelle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
files/en-us/web/svg/reference/attribute/autofocus/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| --- | ||
| title: autofocus | ||
| slug: Web/SVG/Reference/Attribute/autofocus | ||
| page-type: svg-attribute | ||
| browser-compat: svg.global_attributes.autofocus | ||
| sidebar: svgref | ||
| --- | ||
|
|
||
| The **`autofocus`** global SVG attribute defines a focusable element to be focused after it's connected to a document. The attribute has no effect if the element is not already focusable. | ||
|
|
||
| The `autofocus` attribute has an HTML counterpart: [`autofocus`](/en-US/docs/Web/HTML/Reference/Global_attributes/autofocus). No more than one element in the document may have the `autofocus` attribute. If applied to multiple elements, the first one will receive focus. | ||
|
|
||
| ## Usage notes | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aside, but would be good to migrate section name "Usage notes" globally to "Description" to match Web APIs. |
||
|
|
||
| <table class="properties"> | ||
| <tbody> | ||
| <tr> | ||
| <th scope="row">Value</th> | ||
| <td> | ||
| <code><a href="/en-US/docs/Glossary/Boolean/HTML">boolean attribute</a></code> | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <th scope="row">Default value</th> | ||
| <td>(none)</td> | ||
| </tr> | ||
| <tr> | ||
| <th scope="row">Animatable</th> | ||
| <td>No</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
|
|
||
| For a description of the values, please refer to the [HTML `autofocus`](/en-US/docs/Web/HTML/Reference/Global_attributes/autofocus) attribute. | ||
|
|
||
| ## Accessibility concerns | ||
|
|
||
| Automatically focusing an SVG 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 focusable element without warning them beforehand. | ||
|
|
||
| Use careful consideration for accessibility when applying the `autofocus` attribute. Automatically focusing on an element 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 {{glossary("accessible name")}} of the element receiving focus, the screen reader will not announce anything before the element that may provide more context, and the sighted user on a small device will equally miss the context created by the preceding content. | ||
|
|
||
| ## Specifications | ||
|
|
||
| {{Specifications}} | ||
|
|
||
| ## Browser compatibility | ||
|
|
||
| {{Compat}} | ||
|
|
||
| ## See also | ||
|
|
||
| - SVG {{SVGAttr("tabindex")}} attribute | ||
| - HTML [`autofocus`](/en-US/docs/Web/HTML/Reference/Global_attributes/autofocus) attribute | ||
| - {{domxref("SVGElement.autofocus")}} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if this is applied to multiple elements?