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
<button id="dialog-show-my-dialog" data-show-dialog-id="my-dialog" type="button" data-view-component="true" class="Button--secondary Button--medium Button"> <span class="Button-content"> <span class="Button-label">Focus input</span> </span></button><tool-tip id="tooltip-9c5c25b6-3dd4-47f0-b99d-feed2d6d5429" for="dialog-show-my-dialog" popover="manual" data-direction="s" data-type="description" data-view-component="true" class="sr-only position-absolute">This is a tooltip in an Overlay</tool-tip><dialog-helper> <dialog id="my-dialog" aria-modal="true" aria-labelledby="my-dialog-title" aria-describedby="my-dialog-description" data-view-component="true" class="Overlay Overlay-whenNarrow Overlay--size-medium Overlay--motion-scaleFade Overlay--disableScroll"> <div data-view-component="true" class="Overlay-header"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 class="Overlay-title " id="my-dialog-title"> Confirm focus </h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="my-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path> </svg></button> </div> </div> </div> <div data-view-component="true" class="Overlay-body"> Are you sure you want to focus the input? </div> <div data-view-component="true" class="Overlay-footer Overlay-footer--alignEnd"> <button id="yes-button" data-close-dialog-id="my-dialog" type="button" data-view-component="true" class="Button--secondary Button--medium Button"> <span class="Button-content"> <span class="Button-label">Yes</span> </span> </button> <button data-close-dialog-id="my-dialog" type="button" data-view-component="true" class="Button--primary Button--medium Button"> <span class="Button-content"> <span class="Button-label">Yes but in green</span> </span> </button> </div> </dialog></dialog-helper><label> An input <input type="text" id="input" autocomplete="off"></label><script> document.querySelector('#my-dialog').addEventListener('close', function () { document.querySelector('#input').focus(); });</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: "Confirm focus")) do |d| %> <%= render(Primer::Alpha::Dialog::Body.new()) do %> Are you sure you want to focus the input? <% end %> <%= render(Primer::Alpha::Dialog::Footer.new()) do %> <%= render(Primer::Beta::Button.new(id: "yes-button", data: { "close-dialog-id": "my-dialog" })) { "Yes" } %> <%= render(Primer::Beta::Button.new(scheme: :primary, data: { "close-dialog-id": "my-dialog" })) { "Yes but in green" } %> <% end %> <% d.with_show_button do |b| %> Focus input <% b.with_tooltip(text: "This is a tooltip in an Overlay") %> <% end %><% end %><label> An input <input type="text" id="input" autocomplete="off"></label><script> document.querySelector('#my-dialog').addEventListener('close', function () { document.querySelector('#input').focus(); });</script>
No notes provided.
No params configured.
No assets to display.