Skip to content

Commit b79413b

Browse files
asynclizcopybara-github
authored andcommitted
chore(focus): update docs and mark as stable
PiperOrigin-RevId: 534559303
1 parent 26d69c2 commit b79413b

File tree

8 files changed

+28
-5
lines changed

8 files changed

+28
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Chips | 🟡 | ❌ | ❌
3838
Dialog | ✅ | ✅ | ❌
3939
Divider | ✅ | ✅ | ✅
4040
Elevation | ✅ | ✅ | ✅
41-
Focus ring | ✅ | ✅ | 🟡
41+
Focus ring | ✅ | ✅ |
4242
Field | ✅ | ✅ | 🟡
4343
Icon | ✅ | ✅ | ❌
4444
List | ✅ | ✅ | ❌

docs/components/focus-ring.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!--*
44
# Document freshness: For more information, see go/fresh-source.
5-
freshness: { owner: 'lizmitchell' reviewed: '2023-05-08' }
5+
freshness: { owner: 'lizmitchell' reviewed: '2023-05-23' }
66
tag: 'docType:reference'
77
*-->
88

@@ -28,6 +28,8 @@ to determine when they are visible.
2828
Focus rings display on keyboard navigation. They may be attached to a control in
2929
one of three ways.
3030

31+
![An element with a focus ring.](images/focus/usage.gif "A focus ring.")
32+
3133
1. Attached to the parent element
3234

3335
```html
@@ -79,15 +81,36 @@ one of three ways.
7981

8082
> Note: focus rings must be placed within a `position: relative` container.
8183

84+
### Inward
85+
86+
Focus rings can be changed to animate inwards by adding an `inward` attribute.
87+
This is useful for components like list items.
88+
89+
![An element with a focus ring that animates inward.](images/focus/usage-inward.gif "A focus ring animating inward.")
90+
91+
```html
92+
<style>
93+
.container {
94+
position: relative;
95+
--md-focus-ring-shape: 8px;
96+
}
97+
</style>
98+
<button class="container">
99+
<md-focus-ring inward></md-focus-ring>
100+
</button>
101+
```
102+
82103
### Animation
83104

84105
The focus ring animation may be customized or disabled using CSS custom
85106
properties.
86107

108+
![An element with a focus ring that does not animate.](images/focus/usage-animation.gif "A focus ring with disabled animations.")
109+
87110
```html
88111
<style>
89112
:root {
90-
--md-focus-ring-duration: 0; /* disabled animation */
113+
--md-focus-ring-duration: 0s; /* disabled animation */
91114
}
92115
</style>
93116
```
@@ -107,7 +130,6 @@ terms of color and shape.
107130
Token | Default value
108131
------------------------ | --------------------------
109132
`--md-focus-ring-color` | `--md-sys-color-secondary`
110-
`--md-focus-ring-offset` | `2px`
111133
`--md-focus-ring-shape` | `9999px`
112134
`--md-focus-ring-width` | `3px`
113135

@@ -116,13 +138,14 @@ Token | Default value
116138

117139
### Example
118140

119-
![Image of a focus ring with a different theme applied](images/focus/theming.png "Focus ring theming example.")
141+
![Image of a focus ring with a different theme applied](images/focus/theming.gif "Focus ring theming example.")
120142

121143
```html
122144
<style>
123145
:root {
124146
--md-focus-ring-shape: 0px;
125147
--md-focus-ring-width: 2px;
148+
--md-focus-ring-active-width: 4px;
126149
--md-sys-color-secondary: #4A6363;
127150
}
128151
</style>
-53.6 KB
Loading
75.1 KB
Loading
-1.68 KB
Binary file not shown.
66.2 KB
Loading
41.3 KB
Loading
93.7 KB
Loading

0 commit comments

Comments
 (0)