Skip to content

Commit 035b3b5

Browse files
committed
Prettify
1 parent bda669a commit 035b3b5

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/Elastic.Documentation.Site/Assets/open-details-with-anchor.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ export function openDetailsWithAnchor() {
99
// Mark that we're doing a programmatic open
1010
isProgrammaticOpen = true
1111
closestDetails.open = true
12-
12+
1313
// Reset the flag after the toggle event has fired
1414
setTimeout(() => {
1515
isProgrammaticOpen = false
1616
}, 10)
1717
}
18-
18+
1919
// Chrome automatically ensures parent content is visible, scroll immediately
2020
target.scrollIntoView({
2121
behavior: 'instant',
@@ -50,13 +50,19 @@ export function initOpenDetailsWithAnchor() {
5050
window.addEventListener('hashchange', openDetailsWithAnchor)
5151

5252
// Remove data-skip-url-update on first click to enable URL updates
53-
document.addEventListener('click', (event) => {
54-
const target = event.target as HTMLElement
55-
const dropdown = target.closest('details.dropdown') as HTMLDetailsElement
56-
if (dropdown && dropdown.dataset.skipUrlUpdate === "true") {
57-
delete dropdown.dataset.skipUrlUpdate
58-
}
59-
}, true)
53+
document.addEventListener(
54+
'click',
55+
(event) => {
56+
const target = event.target as HTMLElement
57+
const dropdown = target.closest(
58+
'details.dropdown'
59+
) as HTMLDetailsElement
60+
if (dropdown && dropdown.dataset.skipUrlUpdate === 'true') {
61+
delete dropdown.dataset.skipUrlUpdate
62+
}
63+
},
64+
true
65+
)
6066

6167
// Handle manual dropdown toggling to update URL
6268
// Use event delegation to catch all toggle events

0 commit comments

Comments
 (0)