Skip to content

api.Document.visibilitychange_event - re-update Safari & Safari on iOS compatibility #17854

@admbradford

Description

@admbradford

What type of issue is this?

Missing compatibility data

What information was incorrect, unhelpful, or incomplete?

Compatibility for visibilitychange event was resolved for Safari version 14.1 & Safari on iOS version 14.5 which was previously updated #10897

During a rewrite of api/Document.json for visibilitychange to conform to the new events structure. #15084 compatibility was downgraded back to partial compatibility.

With the September 12, 2022 release of Safari 16, might as well update the compatibility table to be up to date with the current version 😄

What browsers does this problem apply to, if applicable?

No response

What did you expect to see?

Oh wasn't expecting to see anything specific, just traveled down the rabbit hole.

Did you test this? If so, how?

Yes I did test compatibility with https://event-logger.glitch.me on both mobile & desktop devices running current versions of safari. And triggering visibilitychange by navigating to a new page in the same window, minimizing the browser and navigating tabs. All show the visibilitychange event firing

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

Do you have anything more you want to share?

Recommendation for updating https://github.com/mdn/browser-compat-data/blob/main/api/Document.json#L6851-#L6875

"safari": [
  {
    "version_added": "16"
  },
  {
    "version_removed": "14.1",
    "version_added": "14",
    "partial_implementation": true,
    "notes": "Doesn't fire the <code>visibilitychange</code> event when navigating away from a document, so also include code to check for the <code>pagehide</code> event (which does fire for that case in all current browsers). See WebKit bugs <a href='https://webkit.org/b/116769'>116769</a>, <a href='https://webkit.org/b/151234'>151234</a>, <a href='https://webkit.org/b/151610'>151610</a>, and <a href='https://webkit.org/b/194897'>194897</a>."
  },
  {
    "version_added": "10.1",
    "partial_implementation": true,
    "notes": [
      "Doesn't fire the <code>visibilitychange</code> event when navigating away from a document, so also include code to check for the <code>pagehide</code> event (which does fire for that case in all current browsers). See WebKit bugs <a href='https://webkit.org/b/116769'>116769</a>, <a href='https://webkit.org/b/151234'>151234</a>, <a href='https://webkit.org/b/151610'>151610</a>, and <a href='https://webkit.org/b/194897'>194897</a>.",
      "Before Safari 14, the event does not bubble, so <code>document.addEventListener('visibilitychange', ...)</code> works, but <code>window.addEventListener('visibilitychange', ...)</code> does not."
    ]
  },
  {
    "version_added": "7",
    "partial_implementation": true,
    "notes": [
      "Doesn't fire the <code>visibilitychange</code> event when navigating away from a document, so also include code to check for the <code>pagehide</code> event (which does fire for that case in all current browsers). See WebKit bugs <a href='https://webkit.org/b/116769'>116769</a>, <a href='https://webkit.org/b/151234'>151234</a>, <a href='https://webkit.org/b/151610'>151610</a>, and <a href='https://webkit.org/b/194897'>194897</a>.",
      "Before Safari 14, the event does not bubble, so <code>document.addEventListener('visibilitychange', ...)</code> works, but <code>window.addEventListener('visibilitychange', ...)</code> does not.",
      "The <code>onvisibilitychange</code> event handler property is not supported."
    ]
  }
],
"safari_ios": [
  {
    "version_added": "16"
  },
  {
    "version_removed": "14.5",
    "version_added": "7",
    "partial_implementation": true,
    "notes": [
      "Doesn't fire the <code>visibilitychange</code> event when navigating away from a document, so also include code to check for the <code>pagehide</code> event (which does fire for that case in all current browsers). See WebKit bugs <a href='https://webkit.org/b/116769'>116769</a>, <a href='https://webkit.org/b/151234'>151234</a>, <a href='https://webkit.org/b/151610'>151610</a>, and <a href='https://webkit.org/b/194897'>194897</a>.",
      "Before Safari 14, the event does not bubble, so <code>document.addEventListener('visibilitychange', ...)</code> works, but <code>window.addEventListener('visibilitychange', ...)</code> does not.",
      "The <code>onvisibilitychange</code> event handler property is not supported."
    ]
  }
]

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilitychange_event

MDN metadata

MDN page report details
  • Query: api.Document.visibilitychange_event
  • Report started: 2022-09-21T21:35:02.425Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    data:apiCompat data for Web APIs. https://developer.mozilla.org/docs/Web/API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions