-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Toggle
[aria-busy="true"]
during requests (#199)
Toggle the `[aria-busy="true"]` attribute to be present on a `<turbo-frame>` element when its navigating, a `<form>` element when it's submitting, or on the `<html>` element during any request, then remove the attribute after the submission or navigation completes. This is a change from the `turbo-frame[busy]` attribute, but aims to achieve the same purpose. For the sake of backwards compatibility, Turbo will continue to toggle the `[busy]` attribute during Frame navigations. By unifying a single, consistent attribute, consumer applications can use a single attribute CSS selector at different depths within their page to hide or show loading indicators. For example, consider a loading indication spinner animation within a submit button that animates while a submission is in progress: ```html <style> .loading-spinner { display: none; } [aria-busy="true"] .loading-spinner { display: block; } </style> <form action="/posts"> <!-- ... --> <button type="submit"> <span class="loading-spinner>...</span> <span>Create Post</span> </button> </form> ``` Similarly, consider a `turbo-frame` scoped loading bar: ```html <style> .loading-bar { display: none; } [aria-busy="true"] .loading-bar { display: block; } </style> <a href="/content" data-turbo-frame="content">...</a> <turbo-frame id="content"> <progress id="content-loading-bar" class="loading-bar" value="0" data-turbo-permanent></progress> <!-- ... --> </turbo-frame> ``` Finally, consider the same `.loading-bar` for page-wide navigation: ```html <style> .loading-bar { display: none; } [aria-busy="true"] .loading-bar { display: block; } </style> <nav> <progress id="loading-bar" class="loading-bar" value="0" data-turbo-permanent></progress> </nav> <!-- ... --> <a href="/posts/1">...</a> ```
- Loading branch information
1 parent
274d369
commit 4a13b6d
Showing
9 changed files
with
46 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<html id="html"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Form</title> | ||
|
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<html id="html"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Frame</title> | ||
|
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<html id="html"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Turbo</title> | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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