You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -50,8 +53,8 @@ If you want to react to the focus change, use function as a children pattern. Wh
50
53
placeholder="Use Tab to activate next input"
51
54
/>
52
55
<button type="submit">Submit</button>
53
-
<p style={{ color: focused ?"danger":"text" }}>
54
-
{focused ?"Focus is inside":"No focus here"}
56
+
<p style={{ color: focused ?'danger':'text' }}>
57
+
{focused ?'Focus is inside':'No focus here'}
55
58
</p>
56
59
</fieldset>
57
60
</form>
@@ -64,76 +67,81 @@ If you want to react to the focus change, use function as a children pattern. Wh
64
67
If you're using a CSS-in-JS library like [styled-components](https://www.styled-components.com) you need to pass a ref using `innerRef` prop. You can use `getRef` function from the parameters.
<input type="text" placeholder="Click to activate first input"/>
92
-
<input type="text" placeholder="Use Tab to activate next input"/>
95
+
<input
96
+
type="text"
97
+
placeholder="Click to activate first input"
98
+
/>
99
+
<input
100
+
type="text"
101
+
placeholder="Use Tab to activate next input"
102
+
/>
93
103
<button>A button to try focus</button>
94
104
</StyledBox>
95
105
)}
96
-
</FocusWithin>;
106
+
</FocusWithin>
97
107
```
98
108
99
109
_Note:_ It's recommended to use `:focus-within` selector instead of interpoaltions whenever possible.
100
110
101
111
## Focus method
102
112
103
-
Sometimes it's needed to focus the container node programmatically. You can use the public method
104
-
`focus`. Note that `tabIndex={-1}` needs to be set on non-interactive elements to make them
105
-
receive focus.
113
+
Sometimes it's needed to focus the container node programmatically. You can use the public method `focus`. Note that `tabIndex={-1}` needs to be set on non-interactive elements to make them receive focus.
0 commit comments