-
Notifications
You must be signed in to change notification settings - Fork 156
Description
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
- Configure the API Reference component with
darkMode: falsein your integration - Load the API Reference page in a browser
- 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
falsesetting
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 modedarkMode: false→ Force light modedarkMode: undefined(or omitted) → Auto-detect based on user preferences
Acceptance Criteria
- Setting
darkMode: falseinitializes the API Reference in light mode - Setting
darkMode: trueinitializes the API Reference in dark mode - Omitting the
darkModesetting allows automatic color mode detection - The initial color mode logic correctly distinguishes between
falseandundefinedvalues - Existing color mode toggle functionality continues to work after initial load
Steps to Test
- Create or modify an API Reference integration to explicitly set
darkMode: false - Load the page in a browser and verify the UI appears in light mode on initial load
- Test with
darkMode: trueand verify dark mode is applied - Test with
darkModeomitted and verify automatic detection works - 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