mdn / yari

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

AddonSidebar is renders as collapsed when viewing WebExtensions methods docs #11613

Open dotproto opened 3 months ago

dotproto commented 3 months ago

Summary

The AddonsSidebar macro does not behave as expected when viewing WebExtensions JavaScript API documentation. When visiting an API namespace page, the "JavaScript APIs" section in the left nav defaults to open, showing all of the available namespaces and highlighting the current page. But when viewing the documentation for a property of a namespace, the "JavaScript APIs" section is collapsed by default. This makes it difficult for users to orient themselves in the documentation or to find other related documentation.

URL

Method: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/alarms/clear Type: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/management/ExtensionInfo Event: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webNavigation/onCommitted

Reproduction steps

  1. Visit https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webNavigation
  2. Observe that the left navigation shows the Methods, Types, and Events available on this namespace.
  3. Scroll up in the left navigation and observe that the "JavaScript APIs" group is expanded.
  4. Navigate to any one of the child properties of this namespace, such as onBeforeNavigate.

Expected behavior

The left nav should still be expanded to the webNavigation namespace, providing easy access to other related methods, types, and events.

Actual behavior

The top level group named "JavaScript APIs" is collapsed.

Device

Desktop

Browser

Firefox

Browser version

Pre-release (e.g. Beta, Nightly or Canary)

Operating system

Mac OS

Screenshot

Screenshot 2024-08-08 at 15-01-40 webNavigation - Mozilla MDN

Screenshot 2024-08-08 at 15-03-00 webNavigation onBeforeNavigate - Mozilla MDN

Anything else?

It appears that AddonsSidebar does not directly set the open property on the <details> element used for "JavaScript APIs". Near as I can tell, the details element's open state is set by build/extract-sidebar.ts. Unfortunately, I couldn't figure out how to debug this so I couldn't proactively fix it.

Validations

dotproto commented 3 months ago

Tagging @Rob--W and @rebloor for visibility.

caugner commented 2 months ago

We will fix this once rari has landed in yari.