From 5675466749ec339f11ece82cf454be39f36befc3 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Fri, 6 Dec 2024 11:09:12 -0500 Subject: [PATCH] EPUB: Apply outline keyboard navigation fix See 21d4efd --- src/dom/epub/epub-view.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dom/epub/epub-view.ts b/src/dom/epub/epub-view.ts index 26f1f98c..3ab734b1 100644 --- a/src/dom/epub/epub-view.ts +++ b/src/dom/epub/epub-view.ts @@ -91,6 +91,8 @@ class EPUBView extends DOMView { private _pageMappingJSON!: string; + private _lastNavigationTime = 0; + constructor(options: DOMViewOptions) { super(options); if (options.data.buf) { @@ -836,7 +838,7 @@ class EPUBView extends DOMView { canNavigateToNextSection: this.canNavigateToNextSection(), flowMode: this.flowMode, spreadMode: this.spreadMode, - outlinePath: this._getOutlinePath() + outlinePath: Date.now() - this._lastNavigationTime > 1500 ? this._getOutlinePath() : undefined, }; this._options.onChangeViewStats(viewStats); } @@ -1151,6 +1153,8 @@ class EPUBView extends DOMView { override navigate(location: NavLocation, options: NavigateOptions = {}) { console.log('Navigating to', location); + this._lastNavigationTime = Date.now(); + options.behavior ||= 'smooth'; if (location.pageNumber) {