@readium/navigator 2.5.6 → 2.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readium/navigator",
3
- "version": "2.5.6",
3
+ "version": "2.5.7",
4
4
  "type": "module",
5
5
  "description": "Next generation SDK for publications in Web Apps",
6
6
  "author": "readium",
@@ -195,6 +195,14 @@ export class FramePoolManager {
195
195
  await newFrame.show(locator.locations.progression); // Show/activate new frame
196
196
 
197
197
  this._currentFrame = newFrame;
198
+
199
+ // Safari retains focus on the hidden iframe; transfer it to the new
200
+ // frame only if no meaningful element in the parent document owns focus.
201
+ if (newFrame) {
202
+ const active = this.container.ownerDocument.activeElement;
203
+ if (active && active.tagName === "IFRAME" && active !== newFrame.iframe)
204
+ newFrame.iframe.focus({ preventScroll: true });
205
+ }
198
206
  }
199
207
  resolve();
200
208
  });
@@ -577,6 +577,12 @@ export class FXLFramePoolManager {
577
577
  }
578
578
  this.previousFrames = newFrames;
579
579
 
580
+ // Safari retains focus on the unfocused iframe; transfer it to the first
581
+ // new frame only if no meaningful element in the parent document owns focus.
582
+ const active = this.container.ownerDocument.activeElement;
583
+ if (active && active.tagName === "IFRAME" && !newFrames.some(f => f.iframe === active))
584
+ newFrames[0]?.iframe.focus({ preventScroll: true });
585
+
580
586
  resolve();
581
587
  });
582
588
 
@@ -176,6 +176,14 @@ export class WebPubFramePoolManager {
176
176
  await newFrame.show(locator.locations.progression);
177
177
 
178
178
  this._currentFrame = newFrame;
179
+
180
+ // Safari retains focus on the hidden iframe; transfer it to the new
181
+ // frame only if no meaningful element in the parent document owns focus.
182
+ if (newFrame) {
183
+ const active = this.container.ownerDocument.activeElement;
184
+ if (active && active.tagName === "IFRAME" && active !== newFrame.iframe)
185
+ newFrame.iframe.focus({ preventScroll: true });
186
+ }
179
187
  }
180
188
  resolve();
181
189
  });