Skip to content

Commit 7710dcc

Browse files
committed
MOBILE-3063 reading: Change behaviour on entering/exiting reading page
1 parent be9ff2d commit 7710dcc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/directives/reading-mode.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class CoreReadingModeDirective implements AfterViewInit, OnDestroy {
6767
await this.addTextViewerButton();
6868
this.element.classList.add('core-reading-mode-ready');
6969

70-
this.enabled = document.body.classList.contains('core-reading-mode-enabled');
70+
this.enabled = document.body.classList.contains('core-reading-mode-enable-on-enter');
7171
if (this.enabled) {
7272
await this.enterReadingMode();
7373
}
@@ -136,6 +136,7 @@ export class CoreReadingModeDirective implements AfterViewInit, OnDestroy {
136136
await this.header?.setEnabled(false);
137137

138138
document.body.classList.add('core-reading-mode-enabled');
139+
document.body.classList.add('core-reading-mode-enable-on-enter');
139140

140141
const elements = document.body.querySelectorAll('[core-reading-mode].core-reading-mode-ready');
141142

@@ -185,6 +186,7 @@ export class CoreReadingModeDirective implements AfterViewInit, OnDestroy {
185186

186187
this.enabled = false;
187188
document.body.classList.remove('core-reading-mode-enabled');
189+
document.body.classList.remove('core-reading-mode-enable-on-enter');
188190

189191
// Enable all styles in element.
190192
this.disabledStyles.forEach((style) => {
@@ -236,6 +238,7 @@ export class CoreReadingModeDirective implements AfterViewInit, OnDestroy {
236238
this.viewportPromise?.cancel();
237239

238240
// Disable reading mode should be done by the user.
241+
document.body.classList.remove('core-reading-mode-enabled');
239242
}
240243

241244
}

0 commit comments

Comments
 (0)