Skip to content

Commit e992b5f

Browse files
authored
Merge pull request #3896 from SwiftPackageIndex/issue-3891
Removed custom keyboard navigation in package lists
2 parents 50638e1 + 0311aac commit e992b5f

File tree

10 files changed

+3
-194
lines changed

10 files changed

+3
-194
lines changed

FrontEnd/main.js

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FrontEnd/scripts/dom_helpers.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,3 @@ HTMLElement.prototype.findParentMatching = function (matches) {
2020
} while ((element = element.parentElement))
2121
return null
2222
}
23-
24-
HTMLDocument.prototype.blurFocusedInputElement = function () {
25-
const activeElement = this.activeElement
26-
if (activeElement.nodeName.toLowerCase() === 'input') activeElement.blur()
27-
}
28-
29-
Window.prototype.scrollToTop = function () {
30-
window.scrollTo(0, 0)
31-
}
32-
33-
Window.prototype.scrollToBottom = function () {
34-
window.scrollTo(0, this.document.body.scrollHeight)
35-
}

FrontEnd/scripts/keycodes.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

FrontEnd/scripts/package_list_navigation.js

Lines changed: 0 additions & 147 deletions
This file was deleted.

FrontEnd/styles/colors.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@
140140

141141
--package-list-border: var(--very-light-grey);
142142
--package-list-background: var(--very-very-light-grey);
143-
--package-list-selectedbackground: var(--very-light-blue);
144143

145144
--error-background: var(--light-red);
146145
--error-text: var(--mid-red);
@@ -289,7 +288,6 @@
289288

290289
--package-list-border: var(--very-dark-grey);
291290
--package-list-background: var(--very-very-dark-grey);
292-
--package-list-selectedbackground: var(--dark-blue);
293291

294292
--error-background: var(--dark-red);
295293
--success-background: var(--very-dark-green);

FrontEnd/styles/package_list.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@
4747
}
4848
}
4949

50-
&.selected {
51-
background-color: var(--package-list-selectedbackground);
52-
}
53-
5450
ul.metadata {
5551
display: inline-flex;
5652
gap: 10px;

Sources/App/Views/Search/SearchShow+View.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ extension SearchShow {
120120
)),
121121
.ul(
122122
.id("package-list"),
123-
// Let the JavaScript know that keyboard navigation on this package list should
124-
// also include navigation into and out of the query field.
125-
.data(named: "focus-query-field", value: String(true)),
126123
.group(
127124
model.packageResults.map { .packageListItem(linkUrl: $0.packageURL, packageName: $0.packageName ?? $0.repositoryName, summary: $0.summary, matchingKeywords: model.matchingKeywords(packageKeywords: $0.keywords), repositoryOwner: $0.repositoryOwner, repositoryName: $0.repositoryName, stars: $0.stars, lastActivityAt: $0.lastActivityAt, hasDocs: $0.hasDocs) }
128125
)

Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SearchShow_document.1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ <h1>
9494
<div class="two-column mobile-reversed">
9595
<section class="package-results">
9696
<h4>Matching packages</h4>
97-
<ul id="package-list" data-focus-query-field="true">
97+
<ul id="package-list">
9898
<li>
9999
<a href="https://example.com/package/one">
100100
<h4>Package One</h4>

Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SearchShow_document_withFilters.1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ <h4>Matching packages where&hellip;</h4>
101101
<span class="filter-value">mit</span>
102102
</li>
103103
</ul>
104-
<ul id="package-list" data-focus-query-field="true">
104+
<ul id="package-list">
105105
<li>
106106
<a href="https://example.com/package/one">
107107
<h4>Package One</h4>

Tests/AppTests/__Snapshots__/WebpageSnapshotTests/SearchShow_document_withXSSAttempt.1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ <h1>
9494
<section class="package-results">
9595
<h4>Matching packages</h4>
9696
<p>No packages found.</p>
97-
<ul id="package-list" data-focus-query-field="true"></ul>
97+
<ul id="package-list"></ul>
9898
<ul class="pagination">
9999
<li class="previous">
100100
<a href="/search?query=&apos;&gt;&quot;&gt;&lt;/script&gt;&lt;svg/onload=confirm(&apos;XSS&apos;)&gt;&page=2">Previous Page</a>

0 commit comments

Comments
 (0)