Skip to content

Commit

Permalink
Menu button examples: Improve High Contrast Support and consistency w…
Browse files Browse the repository at this point in the history
…ith APG Coding Practices (pull #1401)

Updated three menu button examples to:
* Improve Javascript coding; use key  rather than keyCode  in keyboard events; use a single object; use classes instead of prototypes.
* Improve high contrast support and documentation.

Co-authored-by: Valerie Young <[email protected]>
Co-authored-by: Matt King <[email protected]>
Co-authored-by: Carolyn MacLeod <[email protected]>
  • Loading branch information
4 people authored Nov 10, 2020
1 parent 2e8bb44 commit 243f77d
Show file tree
Hide file tree
Showing 21 changed files with 1,356 additions and 1,768 deletions.
56 changes: 0 additions & 56 deletions examples/menu-button/css/MenubuttonLinks.css

This file was deleted.

82 changes: 82 additions & 0 deletions examples/menu-button/css/menu-button-actions.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
.menu-button-actions {
margin: 0;
padding: 0;
}

.menu-button-actions button {
margin: 0;
padding: 6px;
display: inline-block;
position: relative;
background-color: #034575;
border: 1px solid #034575;
font-size: 0.9em;
color: white;
border-radius: 5px;
}

.menu-button-actions [role="menu"] {
display: none;
position: absolute;
margin: 0;
padding: 7px 4px;
border: 2px solid #034575;
border-radius: 5px;
background-color: #eee;
}

.menu-button-actions [role="menuitem"],
.menu-button-actions [role="separator"] {
margin: 0;
padding: 6px;
display: block;
width: 4em;
background-color: #eee;
color: black;
border-radius: 5px;
}

.menu-button-actions [role="separator"] {
padding-top: 3px;
background-image: url("../images/separator.svg");
background-position: center;
background-repeat: repeat-x;
}

.menu-button-actions button svg.down {
padding-left: 0.125em;
fill: currentColor;
stroke: currentColor;
}

.menu-button-actions button[aria-expanded="true"] svg.down {
transform: rotate(180deg);
}

/* focus styling */

.menu-button-actions button:hover,
.menu-button-actions button:focus,
.menu-button-actions button[aria-expanded="true"] {
padding: 4px;
border: 3px solid #034575;
background: #eee;
color: #222;
outline: none;
margin: 0;
}

.menu-button-actions [role="menuitem"].focus,
.menu-button-actions [role="menuitem"]:focus {
padding: 4px;
border: 2px solid #034575;
background: #034575;
color: #fff;
outline: none;
margin: 0;
}

input.action:focus {
outline: 2px solid #034575;
background: #def;
}
78 changes: 78 additions & 0 deletions examples/menu-button/css/menu-button-links.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.menu-button-links {
margin: 0;
font-size: 110%;
}

.menu-button-links button {
margin: 0;
padding: 6px;
display: inline-block;
position: relative;
background-color: #034575;
border: 1px solid #034575;
font-size: 0.9em;
color: white;
border-radius: 5px;
}

.menu-button-links [role="menu"] {
margin: 0;
padding: 7px 4px;
list-style: none;
display: none;
position: absolute;
border: 2px solid #034575;
border-radius: 5px;
background-color: #eee;
}

.menu-button-links [role="menuitem"],
.menu-button-links [role="separator"] {
margin: 0;
padding: 6px;
display: block;
width: 24em;
background-color: #eee;
border: none;
color: black;
border-radius: 5px;
}

.menu-button-links [role="separator"] {
padding-top: 3px;
background-image: url("../images/separator.svg");
background-position: center;
background-repeat: repeat-x;
}

.menu-button-links button svg.down {
padding-left: 0.125em;
fill: currentColor;
stroke: currentColor;
}

.menu-button-links button[aria-expanded="true"] svg.down {
transform: rotate(180deg);
}

/* focus styling */

.menu-button-links button:hover,
.menu-button-links button:focus,
.menu-button-links button[aria-expanded="true"] {
padding: 4px;
border: 3px solid #034575;
background: #eee;
color: #222;
outline: none;
margin: 0;
}

.menu-button-links [role="menuitem"]:focus {
padding: 4px;
border: 2px solid #034575;
background: #034575;
color: #fff;
outline: none;
margin: 0;
}
47 changes: 0 additions & 47 deletions examples/menu-button/css/menuButtonAction.css

This file was deleted.

Loading

0 comments on commit 243f77d

Please sign in to comment.