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
VisuallyHidden is positioned absolutely, so it needs a positioned ancestor. Otherwise, it will be positioned relative to the nearest positioned ancestor, which may be the body, causing undesired scroll bars to appear.
35
24
36
-
See [useRadioGroup](useRadioGroup.html#styling) and [useCheckbox](useCheckbox.html#styling)
37
-
for examples of using `VisuallyHidden` to hide native form elements visually. */}
25
+
```tsx
26
+
<labelstyle={{position: 'relative'}}>
27
+
<VisuallyHidden>
28
+
<inputtype="checkbox" />
29
+
</VisuallyHidden>
30
+
<span>Subscribe to our newsletter</span>
31
+
</label>
32
+
```
38
33
39
-
## Hook
34
+
## Hook
40
35
41
36
In order to allow additional rendering flexibility, the `useVisuallyHidden` hook can be
42
37
used in custom components instead of the `VisuallyHidden` component. It supports the same
43
38
options as the component, and returns props to spread onto the element that should be hidden.
@@ -52,16 +49,12 @@ let {visuallyHiddenProps} = useVisuallyHidden();
52
49
<div{...visuallyHiddenProps}>I am hidden</div>
53
50
```
54
51
55
-
## Gotchas
52
+
## API
56
53
57
-
VisuallyHidden is positioned absolutely, so it needs a positioned ancestor. Otherwise, it will be positioned relative to the nearest positioned ancestor, which may be the body, causing undesired scroll bars to appear.
Copy and paste is a common way to transfer data between locations, either within or between apps. Browsers support copy and paste of selected text content by default, but rich objects with custom data can also be copied and pasted using the [clipboard events](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent) API. For example, an app could support copying and pasting a selected card representing a rich object to a new location, or allow a user to paste files from their device to upload them. This can provide a keyboard accessible alternative to drag and drop.
0 commit comments