forked from una/YouMightNotNeedJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve the example w/ :target, add Safari support
Closes una#2
- Loading branch information
Marcy Sutton
committed
Oct 13, 2016
1 parent
31eb6ca
commit 1266e50
Showing
3 changed files
with
39 additions
and
30 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 |
---|---|---|
@@ -1,8 +1,14 @@ | ||
<a class="modalTrigger" href="#modalDialog1"> | ||
Click Me | ||
<a class="modalTrigger" id="modalTrigger" | ||
href="#modalDialog1"> | ||
Open dialog | ||
</a> | ||
|
||
<dialog class="modal" id="modalDialog1" | ||
tabindex="-1" role="dialog"> | ||
<p>Hello Beautiful!</p> | ||
<div> | ||
<a href="#modalTrigger" aria-label="Close"> | ||
× | ||
</a> | ||
<p>Hello Beautiful!</p> | ||
</div> | ||
</dialog> |
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 |
---|---|---|
@@ -1,16 +1,14 @@ | ||
// Modal is visually hidden until focused. | ||
// This only sort-of works: you can't close | ||
// the dialog with the escape key, and it can't | ||
// contain anything interactive for 2 reasons: | ||
// you wouldn't be able to tab without blurring | ||
// the dialog, and they'd be focusable when | ||
// the dialog is closed (a poor keyboard experience). | ||
.modal { | ||
// Modal is hidden until it matches an anchor | ||
// target. This only sort-of works, as you can't close | ||
// it with the escape key or trap focus inside of it. | ||
.modal { | ||
opacity: 0; | ||
visibility: hidden; | ||
} | ||
|
||
// modal fades in when button | ||
// is in focus (i.e. clicked on) | ||
.modal:focus { | ||
// modal fades in when it matches | ||
// an anchor link (i.e. clicked on) | ||
#modalDialog:target { | ||
opacity: 1; | ||
visibility: hidden; | ||
} |
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