Skip to content

Commit

Permalink
Fix navigation on Safari, hopefully fixes #2275
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed May 8, 2023
1 parent 515e8b7 commit 56abed5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.tscache
.baseDir.js
.baseDir.ts
*.swp
yarn.lock
.nyc_output
yarn-error.log
Expand Down
8 changes: 8 additions & 0 deletions src/lib/output/themes/default/assets/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ if (themeChoice) {
const app = new Application();

Object.defineProperty(window, "app", { value: app });

// Safari is broken and doesn't let you click on a link within
// a <summary> tag, so we have to manually handle clicks there.
document.querySelectorAll("summary a").forEach((el) => {
el.addEventListener("click", () => {
location.assign((el as HTMLAnchorElement).href);
});
});
10 changes: 6 additions & 4 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,11 @@ a.tsd-index-link {
color: var(--color-text);
}
.tsd-accordion-summary {
list-style-type: none;
display: flex;
align-items: center;
list-style-type: none; /* hide marker on non-safari */
outline: none; /* broken on safari, so just hide it */
}
.tsd-accordion-summary::-webkit-details-marker {
display: none; /* hide marker on safari */
}
.tsd-accordion-summary,
.tsd-accordion-summary a {
Expand All @@ -784,7 +786,7 @@ a.tsd-index-link {
cursor: pointer;
}
.tsd-accordion-summary a {
flex-grow: 1;
width: calc(100% - 1.5rem);
}
.tsd-accordion-summary > * {
margin-top: 0;
Expand Down

0 comments on commit 56abed5

Please sign in to comment.