Skip to content

Commit

Permalink
EPUB: Apply outline keyboard navigation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeJellinek committed Dec 6, 2024
1 parent 533ccd3 commit 5675466
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/dom/epub/epub-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ class EPUBView extends DOMView<EPUBViewState, EPUBViewData> {

private _pageMappingJSON!: string;

private _lastNavigationTime = 0;

constructor(options: DOMViewOptions<EPUBViewState, EPUBViewData>) {
super(options);
if (options.data.buf) {
Expand Down Expand Up @@ -836,7 +838,7 @@ class EPUBView extends DOMView<EPUBViewState, EPUBViewData> {
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);
}
Expand Down Expand Up @@ -1151,6 +1153,8 @@ class EPUBView extends DOMView<EPUBViewState, EPUBViewData> {

override navigate(location: NavLocation, options: NavigateOptions = {}) {
console.log('Navigating to', location);
this._lastNavigationTime = Date.now();

options.behavior ||= 'smooth';

if (location.pageNumber) {
Expand Down

0 comments on commit 5675466

Please sign in to comment.