Skip to content

Documentation for HTML Model element (take 2) - #39811

Open
zachernuk wants to merge 5 commits into
mdn:mainfrom
zachernuk:model-element-clean
Open

zachernuk wants to merge 5 commits into
mdn:mainfrom
zachernuk:model-element-clean

Conversation

@zachernuk

Copy link
Copy Markdown

( This is a rebuild of the Model element PR from #39710 )

Preface to the new PR

This branch is a clean rebuild of the substantive content about the HTML Model element from the earlier PR at #39710
where I had alterations to a .lock file. Since I'm not familiar enough with Git to revert one single file in the overall process, I thought it would be best to start fresh. Apologies for the clutter!

Description

This PR adds API documentation about the proposed HTML Model element, a browser-native feature for the in-line display of 3D content. It includes illustrations of some core concepts like perspective, lighting and appropriate file formats.

Motivation

The Model element is a totally new web feature and it'll be exceptionally difficult to add documentation in a piecemeal fashion. I'm hoping that this covers the core concepts enough to author new pages from, and matches the MDN house style well enough that other folks can improve them to the point that they are real!

Additional details

I am submitting provisional documentation for the HTML model element, a feature that is the major source of discussion in the W3C Immersive Web CG (https://github.com/immersive-web/model-element/ )
and which is available as a feature preview in visionOS 2.4. I am an editor of the specification and have been facilitating the discussion around it.

While the specification doesn’t have a lot of detail, the API in visionOS is based on the consensus discussion in the CG, and is described in the Model Element explainer: (https://github.com/immersive-web/model-element/blob/main/explainer.md )

There is also a WebGL/WebXR-based interactive explainer demo available here:
https://immersive-web.github.io/model-element/explainer_demo.html

We also have public samples being contributed by multiple browser vendors in the model element samples repository.
https://immersive-web.github.io/model-element-samples/

We have previously submitted related additions to the WHATWG HTML specification as via an introductory issue and initial PR for the specification stub.
whatwg/html#10901
whatwg/html#11191

Related issues and pull requests

WHATWG/HTML

the Web Platform Tests repository

HTML-ARIA

@zachernuk
zachernuk requested review from a team, estelle and wbamberg and removed request for a team June 5, 2025 21:19
@github-actions github-actions Bot added Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs size/xl [PR only] >1000 LoC changed labels Jun 5, 2025
@zachernuk zachernuk changed the title Proposed documentation for proposed Model element (take 2) Documentation for HTML Model element (take 2) Jun 5, 2025
@github-actions

github-actions Bot commented Jun 5, 2025 •

Copy link
Copy Markdown
Contributor
Preview URLs (20 pages)
Flaws (12)

Note! 8 documents with no flaws that don't need to be listed. 🎉

Found an unexpected or unresolvable flaw? Please report it here.

URL: /en-US/docs/Web/API/HTMLModelElement/autoplay
Title: HTMLModelElement: autoplay property
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.autoplay

URL: /en-US/docs/Web/API/HTMLModelElement/currentSrc
Title: HTMLModelElement: currentSrc property
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.currentSrc

URL: /en-US/docs/Web/API/HTMLModelElement/currentTime
Title: HTMLModelElement: currentTime property
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.currentTime

URL: /en-US/docs/Web/API/HTMLModelElement/duration
Title: HTMLModelElement: duration property
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.duration

URL: /en-US/docs/Web/API/HTMLModelElement/height
Title: HTMLModelElement: height property
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.height

URL: /en-US/docs/Web/API/HTMLModelElement/loop
Title: HTMLModelElement: loop property
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.loop

URL: /en-US/docs/Web/API/HTMLModelElement/pause
Title: HTMLModelElement: pause() method
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.pause

URL: /en-US/docs/Web/API/HTMLModelElement/paused
Title: HTMLModelElement: paused property
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.paused

URL: /en-US/docs/Web/API/HTMLModelElement/play
Title: HTMLModelElement: play() method
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.play

URL: /en-US/docs/Web/API/HTMLModelElement/playbackRate
Title: HTMLModelElement: playbackRate property
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.playbackRate

URL: /en-US/docs/Web/API/HTMLModelElement/width
Title: HTMLModelElement: width property
Flaw count: 1

  • macros:
    • Unknown browser-compat entry: api.HTMLModelElement.width

URL: /en-US/docs/Web/HTML/Reference/Elements/model
Title: <model>: The HTML Model element
Flaw count: 1

  • broken_links:
    • Link /en-US/docs/Web/Accessibility/ARIA/Reference/Roles/model_role doesn't resolve
External URLs (13)

URL: /en-US/docs/Web/API/HTMLModelElement/boundingBoxCenter
Title: HTMLModelElement: boundingBoxCenter property


URL: /en-US/docs/Web/API/HTMLModelElement/boundingBoxExtents
Title: HTMLModelElement: boundingBoxExtents property


URL: /en-US/docs/Web/API/HTMLModelElement/environmentMap
Title: HTMLModelElement: environmentMap property


URL: /en-US/docs/Web/API/HTMLModelElement/playbackRate
Title: HTMLModelElement: playbackRate property


URL: /en-US/docs/Web/HTML/Reference/Elements/model
Title: <model>: The HTML Model element

(comment last updated: 2026-11-12 21:39:58)

@wbamberg

wbamberg commented Jun 6, 2025

Copy link
Copy Markdown
Collaborator

I've talked about this PR with some of the other MDN maintainers, and we don't think this feature is ready to be documented on MDN yet (and therefore isn't ready for a review yet). We use two main criteria for deciding when a feature is ready: the extent to which it's implemented in browsers, and the extent to which there's a stable, detailed, specification for it.

The key place these criteria are described is https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/What_we_write#when_we_document_a_new_technology . In particular, this lists the following as a reason not to document a feature:

It doesn't have a specification or the specification is a rough note that looks liable to change,

This seems applicable to the spec as it stands: https://immersive-web.github.io/model-element/. I know the PR description here says:

While the specification doesn’t have a lot of detail, the API in visionOS is based on the consensus discussion in the CG, and is described in the Model Element explainer: (https://github.com/immersive-web/model-element/blob/main/explainer.md )

...but the explainer is also not detailed enough to function as a spec.

It's my understanding that this is shipping in a technical preview of VisionOS. AFAIK only shipping in a technical preview doesn't count as "shipping" for our purposes, because it doesn't represent evidence that the feature is stable.

The underlying reason for these criteria is that we don't want to document things that are likely to change a lot or potentially not be adopted at all. When we document things too early, one of these things happens quite often.

I think the best plan would be to mark this PR a draft, and continue to update it as the specification matures, and ask for a review when the specification is stable and it is shipping.

@wbamberg
wbamberg removed their request for review June 6, 2025 23:37
@zachernuk

Copy link
Copy Markdown
Author

Thank you for the reasoned response, @wbamberg. I’ll aim to revisit this if/when a browser releases the feature and we have a better basis to reason about what the spec needs to clarify.

@zachernuk

Copy link
Copy Markdown
Author

HTML Model element is now available by default in visionOS 26! Now that more folks will actually be able to see it, I believe we'll be able to start negotiating and filling out specification-class descriptions for multiple vendors to agree on.

@wbamberg I'm open to your recommendations as to whether we add detail to MDN piecemeal, as it's added to a spec, or if we can provide the current state as-is and revise/refine once other vendors are in a position to help us define mandatory algorithm structures etc.

@wbamberg

Copy link
Copy Markdown
Collaborator

@wbamberg I'm open to your recommendations as to whether we add detail to MDN piecemeal, as it's added to a spec, or if we can provide the current state as-is and revise/refine once other vendors are in a position to help us define mandatory algorithm structures etc.

I think it makes sense to wait until the specification is stable and detailed and then file a PR to document the whole thing.

@estelle
estelle marked this pull request as draft June 16, 2025 16:45
@Josh-Cena

Josh-Cena commented Sep 2, 2025 •

Copy link
Copy Markdown
Member

We need to set a deadline for this: if the API does not meet our documentation criteria by then, then we need to close this PR until it does. When would be good? I'm thinking when this PR becomes 6 months old, so Dec 5th.

@Josh-Cena

Josh-Cena commented Sep 2, 2025 •

Copy link
Copy Markdown
Member

I just noticed this comment:

Given the complexity of this feature, we expect the final PR to be quite large and probably take about 1-2 years to complete Stage 3 before sending it over as pull request to the main spec.

So, we would be expecting at least 1-2 years before even a draft spec is available, after which there's still an unknown timespan for editors review, during which time it's entirely possible for the feature to change. So I don't think it's productive for MDN to wait for that. FYI MDN encourages the spec PR to be merged before you start working on content; it's definitely fine for you to work on this in advance but we won't want to allocate resources for it, and a place in the PR queue counts as a resource. Temporal has gone down that path: its initial docs were written in around 2018, 7 years before its official release, and during that time it sat as a branch in a forked repo and the main repo allocates zero resources for it.

@Josh-Cena Josh-Cena closed this Sep 2, 2025
@nt1m

nt1m commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

I think it's a mistake to not document<model> when technologies like <geolocation> or <fencedframe> are being documented on MDN. They're basically the same level of specification, both being incubated in community groups!

<geolocation> was added to the CG explainer only in January 2026 (see WICG/PEPC#85) and already ended up on MDN. <model> has been worked on since the end of 2021 (immersive-web/model-element@c30243a).

It would be great if technologies were treated consistently, regardless of which vendor it comes from.

@nt1m

nt1m commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Safari 27 is shipping model on macOS/iOS in addition to on visionOS (which shipped last year): https://webkit.org/blog/17967/news-from-wwdc26-webkit-in-safari-27-beta/#spatial-web

so the likelihood of change is lesser.

@Josh-Cena

Josh-Cena commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Both of those things being documented is somewhat controversial internally, especially since the future of fencedframe is unclear. They were championed almost entirely by Chromium affiliates. We mostly just want to make sure that continuous care can be given to these docs (which is true for Chromium features).

Happy to reopen if there is browser compat data.

@pepelsbey

pepelsbey commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Let's reopen this PR:

  • Safari has shipped the feature in a stable visionOS browser, with macOS and iOS coming later this year.
  • There's a spec.
  • There's compat data.

It's here to stay, even if in just one browser. It happens. But developers still need documentation to be able to implement these features.

@nt1m

nt1m commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@Josh-Cena Could we re-open this given there is compat data? Thanks!

@Josh-Cena Josh-Cena reopened this Jul 9, 2026

The **`HTMLModelElement.stageMode`** property reflects the [`stagemode`](/en-US/docs/Web/HTML/Reference/Elements/model#stagemode) HTML attribute, which indicates the current stage mode for the model element.

### Value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[markdownlint] reported by reviewdog 🐶
error MD001/heading-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]

@marcoscaceres

Copy link
Copy Markdown

I tend to agree... if the Google ones are in, then this should be in. Otherwise, the Google ones should be removed also.

MDN has a long history of clearly publishing experimental things, but also clearly marking them as such.

@pepelsbey
pepelsbey marked this pull request as ready for review August 19, 2026 16:14
@pepelsbey
pepelsbey requested review from a team as code owners August 19, 2026 16:14
@pepelsbey
pepelsbey requested review from hamishwillee and removed request for a team August 19, 2026 16:14
@pepelsbey

Copy link
Copy Markdown
Member

Shall we continue with this one?

@hamishwillee

Copy link
Copy Markdown
Collaborator

Shall we continue with this one?

Yes. NOw there is compat data this is reviewable. I won't have bandwidth for this until my FF project review queue is fixed, but it is now on my list/radar. Probably later next week.

This branch is a clean rebuild of the substantive content about the `HTML Model element` from the earlier PR at
mdn#39710
where I had alterations to a .lock file.
Since I'm not familiar enough with Git to revert one single file in the overall process, I thought it would be best to start fresh. Apologies for the clutter!
Promote the first h3 to the h2 it should be
@hamishwillee

Copy link
Copy Markdown
Collaborator

We should continue this one, but realistically I won't even be present for a review for a month. Unassigning myself.

@hamishwillee
hamishwillee removed their request for review September 22, 2026 06:51
@Josh-Cena

Copy link
Copy Markdown
Member

I'll try to get this mergeable before end of month. @estelle do you intend to do reviews or should I just take this over?

@zachernuk

Copy link
Copy Markdown
Author

Thank you to everyone participating in this! I am available to make any required changes or answer any questions about the underlying features. Especially following TPAC, there has been a lot of positive movement in the spec and other potential implementations coming forth.

@Josh-Cena Josh-Cena left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments about overall structure. Did not read too closely


{{APIRef("HTML DOM")}}

The **`HTMLModelElement.autoplay`** property reflects the [`autoplay`](/en-US/docs/Web/HTML/Reference/Elements/model#autoplay) HTML attribute, indicating whether playback should automatically begin as soon as the model resource is ready and renderable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the following structure:

The autoplay property of the {{domxref("HTMLModelElement")}} interface indicates ... It reflects the {{HTMLElement("model")}} element's autoplay content attribute.


```js
// false is the default value
document.querySelector("#model").autoplay = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's the default then this example is useless. It should set to true instead, or just show reading the value.


## See also

- {{domxref("HTMLModelElement")}}: Interface used to define the `HTMLModelElement.autoplay` property

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't add descriptions. Just link to HTMLModelElement

## See also

- {{domxref("HTMLModelElement")}}: Interface used to define the `HTMLModelElement.autoplay` property
- {{HTMLElement("audio")}}, {{HTMLElement("video")}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird link targets. Maybe link to their autoplay IDL properties. In general, we avoid linking to HTML docs from API docs as much as possible to avoid confusion and change of context.


{{APIRef("HTML DOM")}}

Once a model resource is ready and renderable, the **`HTMLModelElement.boundingBoxCenter`** property indicates the center of the axis-aligned bounding box (AABB) of a model resource's contents, irrespective of their size.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, all intro paragraphs must begin with "The boundingBoxCenter property of the {{domxref("HTMLModelElement")}} interface indicates..."

Comment on lines +13 to +23
<table><tr><td>

![An equirectangular projection of Earth](earth-equirect.svg)
An equirectangular projection of Earth

</td><td>

![The projection of the equirectangular back to a sphere](earth-spherical.svg)
The projection of the equirectangular back to a sphere

</td></tr></table>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to use a table, the image and its caption should be separate rows


```html
<model
environmentMap="grassland.exr"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTML attributes are lowercase


- Transform is **`orbit-fit`**:
The scale and position reflected by the model's `entityTransform` is forced to be centered on its `boundingBoxCenter` and to accommodate the full size of the model's `boundingBoxExtents`. This differs to - and is likely smaller than - the model's default, [object fit](/en-US/docs/Web/HTML/Reference/Elements/model#object_fit) transformation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never add line breaks between list items

> [!NOTE]
> While environment map resources are provided as images, an appropriate resource should contain a very high dynamic range of luminance values, and may not be appropriate to display directly.

- [`autoplay`](/en-US/docs/Web/API/HTMLModelElement/autoplay)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't link to IDL properties from the HTML docs to avoid the implication that the API docs document HTML. You should keep the API docs as thin as possible, and move anything substantial to this HTML page. See for example: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt, https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset

Comment on lines +109 to +117
```html live-sample___basic-model
<model alt="a model of a teapot">
<source src="./teapot.usdz" type="model/vnd.usdz+zip" />
<source src="./teapot.glb" type="model/gltf+binary" />
<img src="./teapot-fallback.png" alt="a fallback image of the 3D teapot" />
</model>
```

{{EmbedLiveSample('basic-model')}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have no assets so this live sample can't work.

@Josh-Cena

Copy link
Copy Markdown
Member

Hi, would you have time to look at the suggestions this week? If not, I'll just make any edits myself as I see fit.

@estelle
estelle removed their request for review November 24, 2026 12:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs size/xl [PR only] >1000 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants