Skip to content

Issue #11 - [BUG] darkMode set to False does not force light mode in API Reference #17

@rogelio-cmj

Description

@rogelio-cmj

Motivation

The API Reference component accepts a darkMode configuration option that should allow developers to control the initial color mode of the documentation interface.

When darkMode: false is explicitly set but ignored, it creates a confusing developer experience and prevents proper theming control.

Current Behavior

When the darkMode configuration is set to false, the API Reference component does not initialize in light mode as expected. Instead, it behaves as if no preference was set, potentially defaulting to dark mode or using system preferences.

Reproduction Steps

  1. Configure the API Reference component with darkMode: false in your integration
  2. Load the API Reference page in a browser
  3. Observe: The UI does not initialize in light mode as expected. It may appear in dark mode or follow system preferences instead of respecting the explicit false setting

Expected Behavior

When darkMode is explicitly set to false, the API Reference should initialize in light mode regardless of system preferences or other factors. The configuration should support three distinct states:

  • darkMode: true → Force dark mode
  • darkMode: false → Force light mode
  • darkMode: undefined (or omitted) → Auto-detect based on user preferences

Acceptance Criteria

  • Setting darkMode: false initializes the API Reference in light mode
  • Setting darkMode: true initializes the API Reference in dark mode
  • Omitting the darkMode setting allows automatic color mode detection
  • The initial color mode logic correctly distinguishes between false and undefined values
  • Existing color mode toggle functionality continues to work after initial load

Steps to Test

  1. Create or modify an API Reference integration to explicitly set darkMode: false
  2. Load the page in a browser and verify the UI appears in light mode on initial load
  3. Test with darkMode: true and verify dark mode is applied
  4. Test with darkMode omitted and verify automatic detection works
  5. Verify the color mode toggle button still allows users to switch modes after initial load

Submission

Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.

Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions