vidply 1.0.35 → 1.0.36

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.
@@ -11744,6 +11744,7 @@
11744
11744
  var _a;
11745
11745
  this.state.fullscreen = true;
11746
11746
  this.container.classList.add("".concat(this.options.classPrefix, "-fullscreen"));
11747
+ document.body.classList.add("vidply-fullscreen-active");
11747
11748
  this._originalScrollX = window.scrollX || window.pageXOffset;
11748
11749
  this._originalScrollY = window.scrollY || window.pageYOffset;
11749
11750
  this._originalBodyOverflow = document.body.style.overflow;
@@ -11751,20 +11752,58 @@
11751
11752
  this._originalBodyWidth = document.body.style.width;
11752
11753
  this._originalBodyHeight = document.body.style.height;
11753
11754
  this._originalHtmlOverflow = document.documentElement.style.overflow;
11755
+ this._originalBodyBackground = document.body.style.background;
11756
+ this._originalHtmlBackground = document.documentElement.style.background;
11754
11757
  document.body.style.overflow = "hidden";
11755
11758
  document.body.style.width = "100%";
11756
11759
  document.body.style.height = "100%";
11760
+ document.body.style.background = "#000";
11757
11761
  document.documentElement.style.overflow = "hidden";
11762
+ document.documentElement.style.background = "#000";
11758
11763
  this._originalViewport = (_a = document.querySelector('meta[name="viewport"]')) == null ? void 0 : _a.getAttribute("content");
11759
11764
  const viewport = document.querySelector('meta[name="viewport"]');
11760
11765
  if (viewport) {
11761
11766
  viewport.setAttribute("content", "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no");
11762
11767
  }
11763
11768
  window.scrollTo(0, 0);
11769
+ this._makeBackgroundInert();
11764
11770
  this.emit("fullscreenchange", true);
11765
11771
  this.emit("enterfullscreen");
11766
11772
  }
11773
+ /**
11774
+ * Makes all page content except the fullscreen player inert (non-focusable)
11775
+ * This prevents keyboard navigation from focusing on hidden background elements
11776
+ */
11777
+ _makeBackgroundInert() {
11778
+ this._inertElements = [];
11779
+ let current = this.container;
11780
+ while (current && current !== document.body && current !== document.documentElement) {
11781
+ const parent = current.parentElement;
11782
+ if (parent) {
11783
+ Array.from(parent.children).forEach((sibling) => {
11784
+ if (sibling !== current && sibling.nodeType === Node.ELEMENT_NODE && !sibling.hasAttribute("inert") && sibling.tagName !== "SCRIPT" && sibling.tagName !== "STYLE" && sibling.tagName !== "LINK" && sibling.tagName !== "META") {
11785
+ sibling.setAttribute("inert", "");
11786
+ this._inertElements.push(sibling);
11787
+ }
11788
+ });
11789
+ }
11790
+ current = parent;
11791
+ }
11792
+ }
11793
+ /**
11794
+ * Restores interactivity to elements that were made inert during fullscreen
11795
+ */
11796
+ _restoreBackgroundInteractivity() {
11797
+ if (this._inertElements) {
11798
+ this._inertElements.forEach((el) => {
11799
+ el.removeAttribute("inert");
11800
+ });
11801
+ this._inertElements = [];
11802
+ }
11803
+ }
11767
11804
  _disablePseudoFullscreen() {
11805
+ document.body.classList.remove("vidply-fullscreen-active");
11806
+ this._restoreBackgroundInteractivity();
11768
11807
  if (this._originalBodyOverflow !== void 0) {
11769
11808
  document.body.style.overflow = this._originalBodyOverflow;
11770
11809
  delete this._originalBodyOverflow;
@@ -11785,6 +11824,14 @@
11785
11824
  document.documentElement.style.overflow = this._originalHtmlOverflow;
11786
11825
  delete this._originalHtmlOverflow;
11787
11826
  }
11827
+ if (this._originalBodyBackground !== void 0) {
11828
+ document.body.style.background = this._originalBodyBackground;
11829
+ delete this._originalBodyBackground;
11830
+ }
11831
+ if (this._originalHtmlBackground !== void 0) {
11832
+ document.documentElement.style.background = this._originalHtmlBackground;
11833
+ delete this._originalHtmlBackground;
11834
+ }
11788
11835
  if (this._originalViewport !== void 0) {
11789
11836
  const viewport = document.querySelector('meta[name="viewport"]');
11790
11837
  if (viewport) {
@@ -13804,8 +13851,12 @@
13804
13851
  this.state.fullscreen = isFullscreen;
13805
13852
  if (isFullscreen) {
13806
13853
  this.container.classList.add("".concat(this.options.classPrefix, "-fullscreen"));
13854
+ document.body.classList.add("vidply-fullscreen-active");
13855
+ this._makeBackgroundInert();
13807
13856
  } else {
13808
13857
  this.container.classList.remove("".concat(this.options.classPrefix, "-fullscreen"));
13858
+ document.body.classList.remove("vidply-fullscreen-active");
13859
+ this._restoreBackgroundInteractivity();
13809
13860
  this._disablePseudoFullscreen();
13810
13861
  }
13811
13862
  this.emit("fullscreenchange", isFullscreen);