@internetarchive/ia-topnav 1.3.5-alpha17 → 1.3.5-alpha19
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
|
@@ -204,7 +204,7 @@ export default class IATopNav extends LitElement {
|
|
|
204
204
|
tabindex="${this.userMenuTabIndex}"
|
|
205
205
|
@menuToggled=${this.menuToggled}
|
|
206
206
|
@trackClick=${this.trackClick}
|
|
207
|
-
@
|
|
207
|
+
@focusToOtherMenuItem=${(e) => this.currentTab = e.detail}
|
|
208
208
|
></user-menu>
|
|
209
209
|
`;
|
|
210
210
|
}
|
|
@@ -297,7 +297,7 @@ export default class IATopNav extends LitElement {
|
|
|
297
297
|
.mediaSliderOpen=${this.mediaSliderOpen}
|
|
298
298
|
.menus=${this.menus}
|
|
299
299
|
tabindex="${this.mediaSliderOpen ? '1' : '-1'}"
|
|
300
|
-
@
|
|
300
|
+
@focusToOtherMenuItem=${(e) => this.currentTab = e.detail}
|
|
301
301
|
></media-slider>
|
|
302
302
|
</div>
|
|
303
303
|
${this.username ? this.userMenu : this.signedOutDropdown}
|
|
@@ -69,7 +69,7 @@ export default class KeyboardNavigation {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
* Handles arrow key events and focuses the next or previous element
|
|
72
|
+
* Handles arrow key events and focuses the next or previous element for topnav sub-nav and usermenu
|
|
73
73
|
* @param {string} key - The key that was pressed ('ArrowDown', 'ArrowRight', 'ArrowUp', or 'ArrowLeft').
|
|
74
74
|
*/
|
|
75
75
|
handleArrowKey(key) {
|
|
@@ -102,7 +102,7 @@ export default class KeyboardNavigation {
|
|
|
102
102
|
handleTabKey(event) {
|
|
103
103
|
if (this.menuOption) {
|
|
104
104
|
const isShiftPressed = event.shiftKey;
|
|
105
|
-
this.
|
|
105
|
+
this.focusToOtherMenuItems(isShiftPressed);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
this.focusableElements[this.focusedIndex]?.blur();
|
|
@@ -110,12 +110,12 @@ export default class KeyboardNavigation {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
* Focuses the
|
|
113
|
+
* Focuses the other parent menu items based on the provided flag.
|
|
114
114
|
* @param {boolean} isPrevious - A flag indicating whether to focus the previous menu item.
|
|
115
115
|
*/
|
|
116
|
-
|
|
116
|
+
focusToOtherMenuItems(isPrevious = false) {
|
|
117
117
|
this.elementsContainer.dispatchEvent(
|
|
118
|
-
new CustomEvent('
|
|
118
|
+
new CustomEvent('focusToOtherMenuItem', {
|
|
119
119
|
bubbles: true,
|
|
120
120
|
composed: true,
|
|
121
121
|
detail: {
|
package/src/media-button.js
CHANGED
|
@@ -103,7 +103,6 @@ class MediaButton extends TrackedElement {
|
|
|
103
103
|
@click=${this.followable ? this.trackClick : this.onClick}
|
|
104
104
|
data-event-click-tracking="${this.analyticsEvent}"
|
|
105
105
|
title="${this.tooltipPrefix} ${this.mediatype} menu"
|
|
106
|
-
tabindex="${this.openMenu === 'media' ? '' : '0'}"
|
|
107
106
|
>
|
|
108
107
|
${this.menuItem}
|
|
109
108
|
</a>
|
package/src/media-menu.js
CHANGED
|
@@ -90,7 +90,8 @@ class MediaMenu extends LitElement {
|
|
|
90
90
|
linkItem.classList.remove('selected');
|
|
91
91
|
linkItem.blur();
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
const newFocusIndex = this.currentTab.moveTo === 'next' ? index + 1 : index - 1;
|
|
94
|
+
mediaButtons[newFocusIndex].shadowRoot.querySelector('a.menu-item').focus();
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
});
|
|
@@ -153,11 +153,10 @@ export default css`
|
|
|
153
153
|
height: 100%;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
.user-menu:hover,
|
|
157
|
-
.user-menu:focus {
|
|
156
|
+
button.user-menu:hover,
|
|
157
|
+
button.user-menu:focus {
|
|
158
158
|
color: var(--linkHoverColor);
|
|
159
159
|
outline: none;
|
|
160
|
-
img { box-shadow: 0 0 0 1px #fff; }
|
|
161
160
|
}
|
|
162
161
|
|
|
163
162
|
.user-menu.active {
|