Skip to content

Commit c9524a5

Browse files
jongundsmhigleymcking65Valerie Young
authored
Editor Menubar Example: Improve high contrast support and refactor Javascript (pull #1356)
Resolves issue #1355 for the editor menubar example by: * Simplifying the Javascript code to use a single object. * Replace PNG files with SVG. * Improving high contrast support * Makes corresponding editorial revisions to documentation. * Fixes bug with testing space key. Co-authored-by: Sarah Higley <[email protected]> Co-authored-by: Matt King <[email protected]> Co-authored-by: Valerie Young <[email protected]>
1 parent 4270cba commit c9524a5

13 files changed

+2964
-0
lines changed
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
.menubar-editor {
2+
margin: 0;
3+
padding: 2px;
4+
width: 560px;
5+
}
6+
7+
.menubar-editor.focus {
8+
padding: 0;
9+
border: solid 2px #034575;
10+
}
11+
12+
.menubar-editor textarea {
13+
padding: 4px;
14+
margin: 0;
15+
border: 2px solid #eee;
16+
height: 400px;
17+
width: 548px;
18+
font-size: medium;
19+
font-family: sans-serif;
20+
}
21+
22+
.menubar-editor [role="menubar"] {
23+
margin: 0;
24+
padding: 2px;
25+
border: 2px solid #eee;
26+
font-size: 110%;
27+
list-style: none;
28+
background-color: #eee;
29+
height: 32px;
30+
display: block;
31+
}
32+
33+
.menubar-editor [role="menubar"] li {
34+
margin: 0;
35+
padding: 0;
36+
list-style: none;
37+
}
38+
39+
.menubar-editor [role="menubar"] > li {
40+
display: inline-block;
41+
position: relative;
42+
top: 3px;
43+
left: 1px;
44+
}
45+
46+
.menubar-editor [role="menubar"] > li > [role="menuitem"]::after {
47+
content: url('../images/down-arrow.svg');
48+
padding-left: 0.25em;
49+
}
50+
51+
.menubar-editor [role="menubar"] > li > [role="menuitem"]:focus::after {
52+
content: url('../images/down-arrow-focus.svg');
53+
}
54+
55+
.menubar-editor [role="menubar"] > li > [role="menuitem"][aria-expanded="true"]::after {
56+
content: url('../images/up-arrow-focus.svg');
57+
}
58+
59+
.menubar-editor [role="menubar"] [role="menu"] {
60+
display: none;
61+
margin: 0;
62+
padding: 2px;
63+
position: absolute;
64+
border: 2px solid #034575;
65+
background-color: #eee;
66+
}
67+
68+
.menubar-editor [role="menubar"] [role="group"] {
69+
margin: 0;
70+
padding: 0;
71+
}
72+
73+
.menubar-editor [role="menubar"] [role="menuitem"][aria-disabled="true"] {
74+
color: #666;
75+
text-decoration: line-through;
76+
}
77+
78+
.menubar-editor [role="menubar"] [role="menuitem"],
79+
.menubar-editor [role="menubar"] [role="menuitemcheckbox"],
80+
.menubar-editor [role="menubar"] [role="menuitemradio"],
81+
.menubar-editor [role="menubar"] [role="separator"] {
82+
padding: 6px;
83+
background-color: #eee;
84+
border: 0px solid #eee;
85+
color: black;
86+
}
87+
88+
.menubar-editor [role="menubar"] [role="menuitem"][aria-expanded="true"] {
89+
padding: 4px;
90+
border: 2px solid #034575;
91+
background-color: #034575;
92+
color: #fff;
93+
outline: none;
94+
}
95+
96+
.menubar-editor [role="menubar"] [role="menu"] [role="menuitem"],
97+
.menubar-editor [role="menubar"] [role="menu"] [role="menuitemcheckbox"],
98+
.menubar-editor [role="menubar"] [role="menu"] [role="menuitemradio"],
99+
.menubar-editor [role="menubar"] [role="menu"] [role="separator"] {
100+
padding-left: 27px;
101+
width: 8em;
102+
}
103+
104+
.menubar-editor [role="menubar"] [role="separator"] {
105+
padding-top: 3px;
106+
background-image: url('../images/separator.svg');
107+
background-position: center;
108+
background-repeat: repeat-x;
109+
}
110+
111+
.menubar-editor [role="menubar"] [role="menu"] [aria-checked='true'] {
112+
padding: 6px;
113+
padding-left: 8px;
114+
padding-right: 18px;
115+
}
116+
117+
.menubar-editor [role="menubar"] [role='menuitemradio'][aria-checked='true']::before {
118+
content: url('../images/radio-checked.svg');
119+
padding-right: 3px;
120+
}
121+
122+
.menubar-editor [role="menubar"] [role='menuitemcheckbox'][aria-checked='true']::before {
123+
content: url('../images/checkbox-checked.svg');
124+
padding-right: 3px;
125+
}
126+
127+
128+
/* focus and hover styling */
129+
130+
131+
.menubar-editor [role="menubar"] [role="menuitem"]:focus,
132+
.menubar-editor [role="menubar"] [role="menuitemcheckbox"]:focus,
133+
.menubar-editor [role="menubar"] [role="menuitemradio"]:focus {
134+
padding: 4px;
135+
border: 2px solid #034575;
136+
background-color: #034575;
137+
color: #fff;
138+
outline: none;
139+
}
140+
141+
.menubar-editor [role="menubar"] [role='menuitemradio'][aria-checked='true']:focus::before {
142+
content: url('../images/radio-checked-focus.svg');
143+
padding-right: 3px;
144+
}
145+
146+
.menubar-editor [role="menubar"] [role='menuitemcheckbox'][aria-checked='true']:focus::before {
147+
content: url('../images/checkbox-checked-focus.svg');
148+
padding-right: 3px;
149+
}
150+
151+
152+
.menubar-editor [role="menubar"] [role="menuitem"]:hover {
153+
padding: 4px;
154+
border: 2px solid #034575;
155+
}
156+
157+
.menubar-editor [role="menubar"] [role="menu"] [role="menuitem"]:focus,
158+
.menubar-editor [role="menubar"] [role="menu"] [role="menuitemcheckbox"]:focus,
159+
.menubar-editor [role="menubar"] [role="menu"] [role="menuitemradio"]:focus {
160+
padding-left: 25px;
161+
}
162+
163+
.menubar-editor [role="menubar"] [role="menu"] [role="menuitem"][aria-checked='true']:focus,
164+
.menubar-editor [role="menubar"] [role="menu"] [role="menuitemcheckbox"][aria-checked='true']:focus,
165+
.menubar-editor [role="menubar"] [role="menu"] [role="menuitemradio"][aria-checked='true']:focus {
166+
padding-left: 8px;
167+
padding-right: 21px;
168+
}
169+
170+
/*
171+
* Text area styles
172+
*/
173+
.menubar-editor .italic {
174+
font-style: italic;
175+
}
176+
177+
.menubar-editor .bold {
178+
font-weight: bold;
179+
}
180+
181+
.menubar-editor .underline {
182+
text-decoration: underline;
183+
}
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

examples/menubar/images/separator.svg

Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)