Previews

No matching results.

x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<div class="flex flex-col gap-4">
<a href="#" class="underline">A link outside the trap (unreachable by Tab)</a>
<div data-controller="midwest-focus-trap" data-midwest-focus-trap-active-value="true" data-midwest-focus-trap-return-focus-value="true" class="midwest-focus-trap">
<div class="flex flex-col gap-3 rounded-2xl border border-gray-1 p-6 max-w-md">
<p class="font-medium">Focus is trapped in this box</p>
<input id="ft-first" type="text" autocomplete="off" class="rounded-lg border border-gray-1 px-3 py-2" placeholder="First field">
<a id="ft-middle" class="midwest-button variant-default size-default theme-primary" name="button" href="/">
<span class="midwest-button-content">Middle button</span>
<div class="midwest-loading-icon" role="img" aria-label="Loading" aria-hidden="true" style="display: none">
<div class="midwest-loading-icon-inner">
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg viewbox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="Midwest-LoadingIcon__Svg" focusable="false" aria-hidden="true">
<circle cx="15" cy="15" r="15">
<animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
<circle cx="60" cy="15" r="9" fill-opacity="0.3">
<animate attributename="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
<circle cx="105" cy="15" r="15">
<animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
</svg>
</div>
</div>
</a>
<a id="ft-last" class="midwest-button variant-outline size-default theme-primary" name="button" href="/">
<span class="midwest-button-content">Last button</span>
<div class="midwest-loading-icon" role="img" aria-label="Loading" aria-hidden="true" style="display: none">
<div class="midwest-loading-icon-inner">
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg viewbox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="Midwest-LoadingIcon__Svg" focusable="false" aria-hidden="true">
<circle cx="15" cy="15" r="15">
<animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
<circle cx="60" cy="15" r="9" fill-opacity="0.3">
<animate attributename="r" from="9" to="9" begin="0s" dur="0.8s" values="9;15;9" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="0.5" to="0.5" begin="0s" dur="0.8s" values=".5;1;.5" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
<circle cx="105" cy="15" r="15">
<animate attributename="r" from="15" to="15" begin="0s" dur="0.8s" values="15;9;15" calcmode="linear" repeatcount="indefinite"></animate>
<animate attributename="fill-opacity" from="1" to="1" begin="0s" dur="0.8s" values="1;.5;1" calcmode="linear" repeatcount="indefinite"></animate>
</circle>
</svg>
</div>
</div>
</a>
</div>
</div>
<a href="#" class="underline">Another link outside the trap</a>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<div class="flex flex-col gap-4">
<a href="#" class="underline">A link outside the trap (unreachable by Tab)</a>
<%= midwest_focus_trap do %>
<div class="flex flex-col gap-3 rounded-2xl border border-gray-1 p-6 max-w-md">
<p class="font-medium">Focus is trapped in this box</p>
<input id="ft-first" type="text" autocomplete="off" class="rounded-lg border border-gray-1 px-3 py-2" placeholder="First field">
<%= midwest_button(id: "ft-middle") { "Middle button" } %>
<%= midwest_button(id: "ft-last", variant: :outline) { "Last button" } %>
</div>
<% end %>
<a href="#" class="underline">Another link outside the trap</a>
</div>

No assets to display.
Add a .js or .css file alongside the component to see it here.

Accessibility

Figma embed for Focus Trap/default

Annotate a preview to embed its Figma design here:

@figma "https://figma.com/..."