@internetarchive/ia-topnav 1.3.5-alpha10 → 1.3.5-alpha11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/ia-topnav.js
CHANGED
|
@@ -201,7 +201,7 @@ export default class IATopNav extends LitElement {
|
|
|
201
201
|
tabindex="${this.userMenuTabIndex}"
|
|
202
202
|
@menuToggled=${this.menuToggled}
|
|
203
203
|
@trackClick=${this.trackClick}
|
|
204
|
-
@
|
|
204
|
+
@focusToNext=${(e) => this.currentTab = e.detail}
|
|
205
205
|
></user-menu>
|
|
206
206
|
`;
|
|
207
207
|
}
|
|
@@ -294,7 +294,7 @@ export default class IATopNav extends LitElement {
|
|
|
294
294
|
.mediaSliderOpen=${this.mediaSliderOpen}
|
|
295
295
|
.menus=${this.menus}
|
|
296
296
|
tabindex="${this.mediaSliderOpen ? '1' : ''}"
|
|
297
|
-
@
|
|
297
|
+
@focusToNext=${(e) => this.currentTab = e.detail}
|
|
298
298
|
></media-slider>
|
|
299
299
|
</div>
|
|
300
300
|
${this.username ? this.userMenu : this.signedOutDropdown}
|
|
@@ -30,17 +30,19 @@ export default class KeyboardNavigation {
|
|
|
30
30
|
* @returns {HTMLElement[]} An array of focusable elements.
|
|
31
31
|
*/
|
|
32
32
|
getFocusableElements() {
|
|
33
|
-
const focusableTagSelectors = 'a[href], button, input,
|
|
33
|
+
const focusableTagSelectors = 'a[href], button, input, [tabindex]:not([tabindex="-1"])';
|
|
34
34
|
const isDisabledOrHidden = el => !el.hasAttribute('disabled') && !el.getAttribute('aria-hidden');
|
|
35
35
|
|
|
36
36
|
let elements;
|
|
37
37
|
if (this.menuOption === 'web') {
|
|
38
|
+
// wayback focusable elements
|
|
38
39
|
const waybackSlider = this.elementsContainer.querySelector('wayback-slider').shadowRoot;
|
|
39
40
|
const waybackSearch = waybackSlider.querySelector('wayback-search');
|
|
40
41
|
const waybackSearchElements = Array.from(waybackSearch.shadowRoot.querySelectorAll(focusableTagSelectors));
|
|
41
42
|
|
|
42
43
|
const normalElements = Array.from(waybackSlider.querySelectorAll(focusableTagSelectors));
|
|
43
44
|
|
|
45
|
+
// wayback save-form focusable elements
|
|
44
46
|
const savePageForm = waybackSlider.querySelector('save-page-form');
|
|
45
47
|
const savePageFormElements = Array.from(savePageForm.shadowRoot.querySelectorAll(focusableTagSelectors));
|
|
46
48
|
|
|
@@ -101,7 +103,6 @@ export default class KeyboardNavigation {
|
|
|
101
103
|
* @param {KeyboardEvent} event - The keyboard event object.
|
|
102
104
|
*/
|
|
103
105
|
handleTabKey(event) {
|
|
104
|
-
console.log(this)
|
|
105
106
|
if (this.menuOption) {
|
|
106
107
|
const isShiftPressed = event.shiftKey;
|
|
107
108
|
this.focusNextMenuItem(isShiftPressed);
|
|
@@ -117,7 +118,7 @@ export default class KeyboardNavigation {
|
|
|
117
118
|
*/
|
|
118
119
|
focusNextMenuItem(isPrevious = false) {
|
|
119
120
|
this.elementsContainer.dispatchEvent(
|
|
120
|
-
new CustomEvent('
|
|
121
|
+
new CustomEvent('focusToNext', {
|
|
121
122
|
bubbles: true,
|
|
122
123
|
composed: true,
|
|
123
124
|
detail: {
|
package/src/primary-nav.js
CHANGED
|
@@ -83,11 +83,9 @@ class PrimaryNav extends TrackedElement {
|
|
|
83
83
|
|
|
84
84
|
updated(props) {
|
|
85
85
|
const { currentTab } = this;
|
|
86
|
-
console.log(currentTab)
|
|
87
86
|
const isUserMenuTab = currentTab && currentTab.mediatype === 'usermenu';
|
|
88
87
|
if (props.has('currentTab')) {
|
|
89
88
|
if (isUserMenuTab) {
|
|
90
|
-
console.log('inside-user-menu');
|
|
91
89
|
const focusElement = currentTab.moveTo === 'next'
|
|
92
90
|
? this.shadowRoot.querySelector('a.upload')
|
|
93
91
|
: this.shadowRoot.querySelector('.user-menu');
|
|
@@ -96,7 +94,6 @@ class PrimaryNav extends TrackedElement {
|
|
|
96
94
|
focusElement.focus();
|
|
97
95
|
}
|
|
98
96
|
} else if (this.currentTab.moveTo === 'next') {
|
|
99
|
-
console.log('inside-media-menu');
|
|
100
97
|
this.shadowRoot.querySelector('.user-menu').focus();
|
|
101
98
|
}
|
|
102
99
|
}
|
|
@@ -224,7 +221,6 @@ class PrimaryNav extends TrackedElement {
|
|
|
224
221
|
data-event-click-tracking="${this.config.eventCategory}|NavHome"
|
|
225
222
|
title="Go home"
|
|
226
223
|
class="link-home"
|
|
227
|
-
tabindex="-1"
|
|
228
224
|
>${icons.iaLogo}${logoWordmarkStacked}</a
|
|
229
225
|
>
|
|
230
226
|
${this.secondLogoSlot}
|
|
@@ -2,7 +2,6 @@ import { css } from 'https://offshoot.prod.archive.org/lit.js';
|
|
|
2
2
|
|
|
3
3
|
export default css`
|
|
4
4
|
button:focus,
|
|
5
|
-
a:focus,
|
|
6
5
|
input:focus {
|
|
7
6
|
outline: none;
|
|
8
7
|
}
|
|
@@ -157,6 +156,7 @@ export default css`
|
|
|
157
156
|
.user-menu:hover,
|
|
158
157
|
.user-menu:focus {
|
|
159
158
|
color: var(--linkHoverColor);
|
|
159
|
+
outline: none;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
.user-menu.active {
|
|
@@ -174,6 +174,10 @@ export default css`
|
|
|
174
174
|
text-decoration: none;
|
|
175
175
|
display: inline-flex;
|
|
176
176
|
}
|
|
177
|
+
a.link-home:focus,
|
|
178
|
+
a.link-home:focus-visible {
|
|
179
|
+
outline-offset: 1px;
|
|
180
|
+
}
|
|
177
181
|
|
|
178
182
|
@media only screen and (min-width: 890px) and (max-device-width: 905px) {
|
|
179
183
|
.branding.second-logo {
|
|
@@ -217,10 +221,6 @@ export default css`
|
|
|
217
221
|
display: none;
|
|
218
222
|
}
|
|
219
223
|
|
|
220
|
-
.branding {
|
|
221
|
-
margin-top: 1rem;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
224
|
.ia-logo,
|
|
225
225
|
.ia-wordmark {
|
|
226
226
|
margin-right: 10px;
|
|
@@ -272,6 +272,9 @@ export default css`
|
|
|
272
272
|
.upload:hover {
|
|
273
273
|
color: var(--linkHoverColor);
|
|
274
274
|
}
|
|
275
|
+
.upload:focus-visible {
|
|
276
|
+
outline: none;
|
|
277
|
+
}
|
|
275
278
|
|
|
276
279
|
.upload svg {
|
|
277
280
|
vertical-align: middle;
|