Skip to content

Conversation

@martijnrusschen
Copy link
Member

Summary

Added styling for the month/year <select> dropdown elements that were previously unstyled:

  • .react-datepicker__month-select
  • .react-datepicker__year-select
  • .react-datepicker__month-year-select

Problem

When using showMonthDropdown, showYearDropdown, or showMonthYearDropdown with dropdownMode="select", the native <select> elements had no styling and used browser defaults. This caused issues:

  • Dark text on dark background in dark mode themes
  • Inconsistent appearance with the rest of the datepicker
  • No visual integration with custom themes

Solution

Added base styles that:

  • Use transparent background to inherit from parent container
  • Use color: inherit to match parent's text color
  • Apply consistent border, border-radius, and font styling from the datepicker's variables
  • Include focus-visible outline for accessibility
  • Use cursor: pointer for better UX

This approach allows the dropdowns to work correctly with both light and dark themes by inheriting colors from their parent elements, rather than hardcoding specific color values.

Generated CSS

.react-datepicker__month-select,
.react-datepicker__year-select,
.react-datepicker__month-year-select {
  background-color: transparent;
  border: 1px solid #aeaeae;
  border-radius: 0.3rem;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: 2px;
}
.react-datepicker__month-select:focus-visible,
.react-datepicker__year-select:focus-visible,
.react-datepicker__month-year-select:focus-visible {
  outline: auto 1px;
}

Test Plan

  • CSS builds without errors
  • All 1466 tests pass
  • Linting passes

Fixes #5786

🤖 Generated with Claude Code

Add styling for .react-datepicker__month-select, .react-datepicker__year-select,
and .react-datepicker__month-year-select elements which were previously unstyled.

The new styles use:
- transparent background to inherit from parent (works with dark/light themes)
- color: inherit to match the parent's text color
- consistent border, border-radius, and font styling
- focus-visible outline for accessibility

This fixes issues where the native <select> elements would display with
browser default styling, which looked bad especially in dark mode themes.

Fixes #5786

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.18%. Comparing base (9e4795d) to head (9f736c2).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6169      +/-   ##
==========================================
- Coverage   99.26%   99.18%   -0.08%     
==========================================
  Files          30       30              
  Lines        3801     3801              
  Branches     1652     1652              
==========================================
- Hits         3773     3770       -3     
- Misses         27       29       +2     
- Partials        1        2       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@martijnrusschen martijnrusschen merged commit d512847 into main Dec 18, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSS Theming Issue with Month/Year <select> Dropdowns in Dark/Light Mode

2 participants