mdn / yari

The platform code behind MDN Web Docs
Mozilla Public License 2.0
1.18k stars 501 forks source link

Fix broken smartLinks #7677

Open caugner opened 1 year ago

caugner commented 1 year ago

(Extracted from the latest Prod Build - 2022-11-25.)

In APIRef the smartLink to ...

In CSSRef the smartLink to ...

In CSS_Ref the smartLink to ...

Other:

caugner commented 1 year ago

Looks like it's hard to analyze without the log context... 🙁

Example:

  • /en-US/docs/Web/API/HTMLMediaElement/mediaKeys is broken

This is caused by https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySession/keystatuseschange_event, which has a link to mediaKeys in the sidebar:

image

I wonder why!? 🤔

@wbamberg Do you have an explanation for why a link to the non-existing HTMLMediaElement.mediaKeys page appears there?

wbamberg commented 1 year ago

@wbamberg Do you have an explanation for why a link to the non-existing HTMLMediaElement.mediaKeys page appears there?

It's because https://developer.mozilla.org/en-US/docs/Web/API/MediaKeySession/keystatuseschange_event is declaring a sidebar like this:

{{APIRef("Encrypted Media Extensions")}}

...which is telling APIRef that this feature belongs to the "Encrypted Media Extensions" group, so APIRef will add links for everything it finds in that group. And the group for "Encrypted Media Extensions" in GroupData includes HTMLMediaElement.mediaKeys:

    "Encrypted Media Extensions": {
      "overview": ["Encrypted Media Extensions API"],
      "interfaces": [
        "MediaKeyMessageEvent",
        "MediaKeys",
        "MediaKeySession",
        "MediaKeyStatusMap",
        "MediaKeySystemAccess"
      ],
      "methods": [
        "Navigator.requestMediaKeySystemAccess()",
        "HTMLMediaElement.setMediaKeys()"
      ],
      "properties": ["HTMLMediaElement.mediaKeys"],
      "events": ["HTMLMediaElement: encrypted"]
    },

FWIW (and fairly unusually for Web/API sidebars) this seems to be all correct, on its own terms at least: MediaKeySession.keystatuseschange does belong to the EME spec, and that spec does also define HTMLMediaElement.mediaKeys.

So one fix is to write a page for HTMLMediaElement.mediaKeys. Or we might want to say that GroupData shouldn't list any pages that don't exist, even if they are part of the group. Or we might update APIRef to discard entries that don't exist.

MrBrain295 commented 1 year ago

I fixed VideoStreamTrack in mdn/content#22546.