Skip to content

Commit 56abed5

Browse files
committed
Fix navigation on Safari, hopefully fixes #2275
1 parent 515e8b7 commit 56abed5

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.tscache
55
.baseDir.js
66
.baseDir.ts
7+
*.swp
78
yarn.lock
89
.nyc_output
910
yarn-error.log

src/lib/output/themes/default/assets/bootstrap.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ if (themeChoice) {
1919
const app = new Application();
2020

2121
Object.defineProperty(window, "app", { value: app });
22+
23+
// Safari is broken and doesn't let you click on a link within
24+
// a <summary> tag, so we have to manually handle clicks there.
25+
document.querySelectorAll("summary a").forEach((el) => {
26+
el.addEventListener("click", () => {
27+
location.assign((el as HTMLAnchorElement).href);
28+
});
29+
});

static/style.css

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,9 +770,11 @@ a.tsd-index-link {
770770
color: var(--color-text);
771771
}
772772
.tsd-accordion-summary {
773-
list-style-type: none;
774-
display: flex;
775-
align-items: center;
773+
list-style-type: none; /* hide marker on non-safari */
774+
outline: none; /* broken on safari, so just hide it */
775+
}
776+
.tsd-accordion-summary::-webkit-details-marker {
777+
display: none; /* hide marker on safari */
776778
}
777779
.tsd-accordion-summary,
778780
.tsd-accordion-summary a {
@@ -784,7 +786,7 @@ a.tsd-index-link {
784786
cursor: pointer;
785787
}
786788
.tsd-accordion-summary a {
787-
flex-grow: 1;
789+
width: calc(100% - 1.5rem);
788790
}
789791
.tsd-accordion-summary > * {
790792
margin-top: 0;

0 commit comments

Comments
 (0)