-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tooltips opening when focus is removed while displaying (#2281)
Co-authored-by: Jon Rohan <rohan@github.com> Co-authored-by: Jon Rohan <yes@jonrohan.codes>
- Loading branch information
1 parent
0e7bc4d
commit 46d5d9c
Showing
5 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/view-components": patch | ||
--- | ||
|
||
Fix tooltips opening when focus is removed while displaying |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
previews/primer/alpha/tooltip_preview/tooltip_with_dialog_moving_focus_to_input.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<%= 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"> | ||
</label> | ||
<script> | ||
document.querySelector('#my-dialog').addEventListener('cancel', function () { | ||
console.log('!!') | ||
setTimeout(() => document.querySelector('#input').focus(), 0); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters