@internetarchive/ia-topnav 1.3.4 → 1.3.5-alpha1
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 +1 -1
- package/src/nav-search.js +1 -7
- package/src/primary-nav.js +11 -1
- package/src/search-menu.js +25 -1
- package/src/styles/search-menu.js +3 -0
package/package.json
CHANGED
package/src/nav-search.js
CHANGED
|
@@ -34,13 +34,6 @@ class NavSearch extends TrackedElement {
|
|
|
34
34
|
this.initSearchBetaOptIn();
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
updated() {
|
|
38
|
-
if (this.open) {
|
|
39
|
-
this.shadowRoot.querySelector('[name=query]').focus();
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
37
|
initSearchBetaOptIn() {
|
|
45
38
|
this.inSearchBeta = !!window.localStorage?.getItem('SearchBeta-opt-in') ||
|
|
46
39
|
!!window.localStorage?.getItem('SearchBeta-launched');
|
|
@@ -112,6 +105,7 @@ class NavSearch extends TrackedElement {
|
|
|
112
105
|
<button
|
|
113
106
|
type="submit"
|
|
114
107
|
class="search"
|
|
108
|
+
tabindex="-1"
|
|
115
109
|
data-event-click-tracking="${this.config.eventCategory}|NavSearchClose"
|
|
116
110
|
>
|
|
117
111
|
${icons.search}
|
package/src/primary-nav.js
CHANGED
|
@@ -107,6 +107,7 @@ class PrimaryNav extends TrackedElement {
|
|
|
107
107
|
.dropdownOpen=${this.signedOutMenuOpen}
|
|
108
108
|
.openMenu=${this.openMenu}
|
|
109
109
|
@signedOutMenuToggled=${this.signedOutMenuToggled}
|
|
110
|
+
tabindex="-1"
|
|
110
111
|
></login-button>
|
|
111
112
|
`;
|
|
112
113
|
}
|
|
@@ -152,7 +153,15 @@ class PrimaryNav extends TrackedElement {
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
get uploadButtonTemplate() {
|
|
155
|
-
return html
|
|
156
|
+
return html`
|
|
157
|
+
<a href="${formatUrl('/create', this.baseHost)}"
|
|
158
|
+
class="upload"
|
|
159
|
+
tabindex="1"
|
|
160
|
+
@focus=${(e) => {
|
|
161
|
+
if (e.relatedTarget !== null) {
|
|
162
|
+
this.toggleSearchMenu(e)
|
|
163
|
+
}
|
|
164
|
+
}}>
|
|
156
165
|
${icons.upload}
|
|
157
166
|
<span>Upload</span>
|
|
158
167
|
</a>`;
|
|
@@ -188,6 +197,7 @@ class PrimaryNav extends TrackedElement {
|
|
|
188
197
|
data-event-click-tracking="${this.config.eventCategory}|NavHome"
|
|
189
198
|
title="Go home"
|
|
190
199
|
class="link-home"
|
|
200
|
+
tabindex="-1"
|
|
191
201
|
>${icons.iaLogo}${logoWordmarkStacked}</a
|
|
192
202
|
>
|
|
193
203
|
${this.secondLogoSlot}
|
package/src/search-menu.js
CHANGED
|
@@ -29,6 +29,29 @@ class SearchMenu extends TrackedElement {
|
|
|
29
29
|
this.selectedSearchType = '';
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
firstUpdated() {
|
|
33
|
+
this.shadowRoot.addEventListener('keyup', (e) => {
|
|
34
|
+
const searchTypes = this.shadowRoot.querySelectorAll('.search-menu-inner label input[type=radio]');
|
|
35
|
+
const length = searchTypes.length - 1;
|
|
36
|
+
|
|
37
|
+
// early return if searchTypes not found
|
|
38
|
+
if (!length) return;
|
|
39
|
+
|
|
40
|
+
const searchTypeHandler = (index) => {
|
|
41
|
+
const searchType = searchTypes[index];
|
|
42
|
+
searchType.checked = true;
|
|
43
|
+
searchType.dispatchEvent(new Event('change'));
|
|
44
|
+
searchType.focus();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
if (e.key === 'Home') {
|
|
48
|
+
searchTypeHandler(0);
|
|
49
|
+
} else if (e.key === 'End') {
|
|
50
|
+
searchTypeHandler(length);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
32
55
|
selectSearchType(e) {
|
|
33
56
|
this.selectedSearchType = e.target.value;
|
|
34
57
|
}
|
|
@@ -70,7 +93,7 @@ class SearchMenu extends TrackedElement {
|
|
|
70
93
|
}
|
|
71
94
|
return html`
|
|
72
95
|
<label @click="${this.selectSearchType}">
|
|
73
|
-
<input form="nav-search" type="radio" name="sin" value="${value}" ?checked=${isDefault} @change=${this.searchInChanged} />
|
|
96
|
+
<input tabindex="3" form="nav-search" type="radio" name="sin" value="${value}" ?checked=${isDefault} @change=${this.searchInChanged} />
|
|
74
97
|
Search ${label}
|
|
75
98
|
</label>
|
|
76
99
|
`;
|
|
@@ -104,6 +127,7 @@ class SearchMenu extends TrackedElement {
|
|
|
104
127
|
href="${formatUrl('/advancedsearch.php', this.baseHost)}"
|
|
105
128
|
@click=${this.trackClick}
|
|
106
129
|
data-event-click-tracking="${this.config.eventCategory}|NavAdvancedSearch"
|
|
130
|
+
tabindex="4"
|
|
107
131
|
>Advanced Search</a
|
|
108
132
|
>
|
|
109
133
|
</div>
|