Skip to content

[Web API type definition issue] Element.requestFullscreen should be optional #2211

Open

Description

Summary

typeof document.documentElement.requestFullscreen is undefined in iOS Safari

Expected vs. Actual Behavior

typeof document.documentElement.requestFullscreen

Expected: not defined in iOS 26.0.1 Safari (and probably in the webview)
Actual: always a function

Playground Link

No response

Browser Support

  • This API is supported in at least two major browser engines (not two Chromium-based browsers).

Have Tried The Latest Releases

  • This issue applies to the latest release of TypeScript.
  • This issue applies to the latest release of @types/web.

Additional Context

Suggested change will enforce optional chaining for safer runtime code.

document.documentElement.requestFullscreen?.()

Activity

  1. jakebailey commented on Oct 29, 2025

    @jakebailey
    Member

    It's only undefined because Safari doesn't implement it yet: https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen

    We don't generally make everything potentially undefined because one browser is lagging behind. If two engines have the feature, then we include the type.

  2. hyunbinseo commented on Oct 29, 2025

    @hyunbinseo
    Author

    I do understand that iOS Safari is the only one lagging behind, but is Apple even willing to implement it?

    I would love to know a way to config it as optional — I wasn't doing QA with iPhones, and I've had to fix mistakes in bulk with a string search.

  3. saschanaz commented on Nov 5, 2025

    @saschanaz
    Contributor

    What version of iOS Safari are we talking about? Per the WebKit IDL it should be available everywhere. 🤔

  4. hyunbinseo commented on Nov 5, 2025

    @hyunbinseo
    Author

    Kagami Sascha Rosylight (@saschanaz) all versions of iOS Safari including the latest 26.

    Personal test results:

    iOS@26.0.1: undefined
    iPadOS@18.7: function

    Image

    https://caniuse.com/fullscreen

    Only available on iPad, not on iPhone.
    Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.

    https://github.com/mdn/browser-compat-data/blob/88673dfeb94aa588d96baf90dbc8742538d78d12/api/Element.json#L4805-L4813

  5. saschanaz commented on Nov 5, 2025

    @saschanaz
    Contributor

    The source of truth is the WebKit source code, everything else is an observed result. 🤔

  6. saschanaz commented on Nov 5, 2025

    @saschanaz
    Contributor

    I guess iOS doesn't have webkitRequestFullScreen either?

  7. saschanaz commented on Nov 5, 2025

    @saschanaz
    Contributor

    fwiw, you can use https://mdn-bcd-collector.gooborg.com/ (the same thing that MDN uses to gather the data)

  8. hyunbinseo commented on Nov 8, 2025

    @hyunbinseo
    Author

    These are the tests I've ran. Is there a webkit prefixed version that I am supposed to run?

    api.Element.requestFullscreen
    api.Element.requestFullscreen.returns_promise
    
    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions