-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accordion Example: add optional keys (pull #397)
1. Adds the following (optional) keyboard commands based on issue #158: * Up/ Down: Cycle focus through accordion toggle controls/ headings * Home/ End: Focus first/ last accordion toggle control/ heading * Control + Page Up/ Down: Move focus from accordion panel to accordion heading, and then cycle through headings. 2. Refactors JS and CSS to be simpler to understand.
- Loading branch information
1 parent
597799f
commit f6e1121
Showing
11 changed files
with
237 additions
and
882 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
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,92 +1,71 @@ | ||
/* Contains the accordion elements */ | ||
.accordion { | ||
border: 1px solid hsl(0, 0%, 82%); | ||
border-radius: .3em; | ||
box-shadow: 0 1px 2px hsl(0, 0%, 82%); | ||
.Accordion { | ||
border: 1px solid hsl(0, 0%, 82%); | ||
border-radius: .3em; | ||
box-shadow: 0 1px 2px hsl(0, 0%, 82%); | ||
} | ||
|
||
.accordion > * + * { | ||
border-top: 1px solid hsl(0, 0%, 82%); | ||
.Accordion > * + * { | ||
border-top: 1px solid hsl(0, 0%, 82%); | ||
} | ||
|
||
/* Heading containing accordion button */ | ||
.accordion dt[role="heading"] { | ||
|
||
} | ||
|
||
.accordion dt[role="heading"]:first-of-type > [role="button"] { | ||
border-radius: .3em .3em 0 0; | ||
} | ||
|
||
.accordion dt[role="heading"]:last-of-type > [role="button"] { | ||
border-radius: 0 0 .3em .3em; | ||
} | ||
|
||
.accordion dt[role="heading"]:last-of-type > [role="button"][aria-expanded="true"] { | ||
border-radius: 0; | ||
} | ||
|
||
/* Accordion button */ | ||
.accordion dt > [role="button"] { | ||
display: block; | ||
position: relative; | ||
margin: 0; | ||
padding: 1em 1.5em; | ||
border-bottom: 0; | ||
color: hsl(0, 0%, 13%); | ||
font-weight: normal; | ||
.Accordion-trigger { | ||
background: none; | ||
border: 0; | ||
color: hsl(0, 0%, 13%); | ||
display: block; | ||
font-size: 1rem; | ||
font-weight: normal; | ||
margin: 0; | ||
padding: 1em 1.5em; | ||
position: relative; | ||
text-align: left; | ||
width: 100%; | ||
} | ||
|
||
.accordion dt > [role="button"]:hover, | ||
.accordion dt > [role="button"]:focus { | ||
margin: inherit; | ||
background: hsl(0, 0%, 93%); | ||
.Accordion dt:first-child .Accordion-trigger { | ||
border-radius: .3em .3em 0 0; | ||
} | ||
|
||
/* Accordion button icon */ | ||
.accordion dt > [role="button"] .icon { | ||
position: absolute; | ||
top: 50%; | ||
right: 1.5em; | ||
transform: translateY(-60%) rotate(45deg); | ||
width: 8px; | ||
height: 8px; | ||
border: solid hsl(0, 0%, 62%); | ||
border-width: 0 2px 2px 0; | ||
.Accordion-trigger:focus, | ||
.Accordion-trigger:hover { | ||
background: hsl(0, 0%, 93%); | ||
} | ||
|
||
.accordion dt > [role="button"][aria-expanded="true"] .icon { | ||
transform: translateY(-50%) rotate(-135deg); | ||
.Accordion-icon { | ||
border: solid hsl(0, 0%, 62%); | ||
border-width: 0 2px 2px 0; | ||
height: .5rem; | ||
position: absolute; | ||
right: 1.5em; | ||
top: 50%; | ||
transform: translateY(-60%) rotate(45deg); | ||
width: .5rem; | ||
} | ||
|
||
.accordion dt > [role="button"]:hover .icon, | ||
.accordion dt > [role="button"]:focus .icon { | ||
border-color: hsl(0, 0%, 13%); | ||
.Accordion-trigger:focus .Accordion-icon, | ||
.Accordion-trigger:hover .Accordion-icon { | ||
border-color: hsl(0, 0%, 13%); | ||
} | ||
|
||
/* Accordion panel */ | ||
.accordion dd[role="region"] { | ||
margin: 0; | ||
padding: 1em 1.5em; | ||
/*border: solid hsl(0, 0%, 82%); | ||
border-width: 0 1px;*/ | ||
.Accordion-trigger[aria-expanded="true"] .Accordion-icon { | ||
transform: translateY(-50%) rotate(-135deg); | ||
} | ||
|
||
.accordion dd[role="region"].hidden { | ||
display: none; | ||
.Accordion-panel { | ||
margin: 0; | ||
padding: 1em 1.5em; | ||
} | ||
|
||
/* Basic stuff */ | ||
fieldset { | ||
border: 0; | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
input[type="text"] { | ||
display: block; | ||
padding: .3em .5em; | ||
border: 1px solid hsl(0, 0%, 62%); | ||
border-radius: .3em; | ||
font-size: inherit; | ||
input { | ||
border: 1px solid hsl(0, 0%, 62%); | ||
border-radius: .3em; | ||
display: block; | ||
font-size: inherit; | ||
padding: .3em .5em; | ||
} |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.