@@ -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