|
171 | 171 | e.stopPropagation();
|
172 | 172 | break;
|
173 | 173 | case "home":
|
174 |
| - case "pageup": |
175 | 174 | // home: focus first menu item.
|
176 | 175 | // This is the behavior of WAI, while GitHub scrolls,
|
177 | 176 | // but it's unlikely that a user will try to scroll the page while the menu is open,
|
178 | 177 | // so they won't do it on accident.
|
179 | 178 | switchTo = allItems[0];
|
180 | 179 | break;
|
181 | 180 | case "end":
|
182 |
| - case "pagedown": |
183 | 181 | // end: focus last menu item.
|
184 | 182 | // This is the behavior of WAI, while GitHub scrolls,
|
185 | 183 | // but it's unlikely that a user will try to scroll the page while the menu is open,
|
186 | 184 | // so they won't do it on accident.
|
187 | 185 | switchTo = last(allItems);
|
188 | 186 | break;
|
| 187 | + case "pageup": |
| 188 | + // page up: jump five items up, stopping at the top |
| 189 | + // the number 5 is used so that we go one page in the |
| 190 | + // inner-scrolled Depedencies and Versions fields |
| 191 | + switchTo = currentLink; |
| 192 | + for (var n = 0; n < 5 && switchTo; ++n) { |
| 193 | + switchTo = previous(allItems, switchTo); |
| 194 | + } |
| 195 | + if (!switchTo) { |
| 196 | + switchTo = allItems[0]; |
| 197 | + } |
| 198 | + break; |
| 199 | + case "pagedown": |
| 200 | + // page down: jump five items down, stopping at the bottom |
| 201 | + // the number 5 is used so that we go one page in the |
| 202 | + // inner-scrolled Depedencies and Versions fields |
| 203 | + switchTo = currentLink; |
| 204 | + for (var n = 0; n < 5 && switchTo; ++n) { |
| 205 | + switchTo = next(allItems, switchTo); |
| 206 | + } |
| 207 | + if (!switchTo) { |
| 208 | + switchTo = last(allItems); |
| 209 | + } |
| 210 | + break; |
189 | 211 | }
|
190 | 212 | if (switchTo) {
|
191 | 213 | var switchToLink = switchTo.querySelector("a");
|
|
0 commit comments