dash-core-components 4.0.0-rc4 → 4.0.0-rc5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -253,7 +253,7 @@ function Input({
253
253
  }) as Pick<InputHTMLAttributes<HTMLInputElement>, HTMLInputProps>;
254
254
 
255
255
  const isNumberInput = type === HTMLInputTypes.number;
256
- const currentNumericValue = convert(input.current.value || '0');
256
+ const currentNumericValue = parseFloat(String(value ?? 0)) || 0;
257
257
  const minValue = convert(props.min);
258
258
  const maxValue = convert(props.max);
259
259
  const isDecrementDisabled =
@@ -31,6 +31,7 @@ const Tooltip = ({
31
31
  height: `${position?.y1 - position?.y0}px`,
32
32
  display: `${show_tooltip ? 'inline-block' : 'none'}`,
33
33
  pointerEvents: `${targetable ? 'auto' : 'none'}`,
34
+ '--Dash-Tooltip-PointerEvents': targetable ? 'auto' : 'none',
34
35
  '--Dash-Tooltip-Border-Color': border_color,
35
36
  '--Dash-Tooltip-Background-Color': background_color,
36
37
  '--Dash-Tooltip-ZIndex': zindex,
@@ -99,9 +99,20 @@ Upload.propTypes = {
99
99
  */
100
100
  min_size: _propTypes.default.number,
101
101
  /**
102
- * Allow dropping multiple files
102
+ * Allow dropping multiple files.
103
+ * When true, enables folder drag-and-drop support.
104
+ * The folder hierarchy is preserved in filenames (e.g., 'folder/subfolder/file.txt').
105
+ * Note: Folder drag-and-drop is supported in Chrome, Edge, and Opera.
103
106
  */
104
107
  multiple: _propTypes.default.bool,
108
+ /**
109
+ * Enable folder selection in the file picker dialog.
110
+ * When true with multiple=True, the file picker allows selecting folders instead of files.
111
+ * Note: When folder selection is enabled, individual files cannot be selected via the button.
112
+ * Use separate Upload components if you need both file and folder selection options.
113
+ * Folder selection is supported in Chrome, Edge, and Opera.
114
+ */
115
+ enable_folder_selection: _propTypes.default.bool,
105
116
  /**
106
117
  * HTML class name of the component
107
118
  */
@@ -145,6 +156,7 @@ Upload.defaultProps = {
145
156
  max_size: -1,
146
157
  min_size: 0,
147
158
  multiple: false,
159
+ enable_folder_selection: false,
148
160
  style: {},
149
161
  style_active: {
150
162
  borderStyle: 'solid',
@@ -1,16 +1,14 @@
1
1
  .dash-button {
2
2
  line-height: 32px;
3
- background: color-mix(
4
- in srgb,
5
- var(--Dash-Fill-Interactive-Strong) 5%,
6
- transparent
7
- );
3
+ background: var(--Dash-Fill-Interactive-Weak);
8
4
  color: var(--Dash-Fill-Interactive-Strong);
9
5
  padding: 0 calc(var(--Dash-Spacing) * 2);
10
6
  border-radius: 4px;
11
7
  border: 1px solid var(--Dash-Fill-Interactive-Strong);
12
8
  box-sizing: border-box;
13
9
  vertical-align: middle;
10
+ font-family: inherit;
11
+ font-size: inherit;
14
12
  }
15
13
 
16
14
  /* Hover state - stronger background */
@@ -28,15 +26,12 @@
28
26
 
29
27
  /* Keyboard focus - inverted colors */
30
28
  .dash-button:focus-visible {
31
- outline: none;
32
- background: var(--Dash-Fill-Interactive-Strong);
33
- color: var(--Dash-Fill-Inverse-Strong);
29
+ outline: 1px solid var(--Dash-Fill-Interactive-Strong);
34
30
  }
35
31
 
36
32
  /* Hover after keyboard focus - keep inverted but acknowledge hover */
37
33
  .dash-button:focus-visible:hover {
38
- background: var(--Dash-Fill-Interactive-Strong);
39
- color: var(--Dash-Fill-Inverse-Strong);
34
+ outline: 1px solid var(--Dash-Fill-Interactive-Strong);
40
35
  }
41
36
 
42
37
  /* Active state after keyboard focus - inverted colors */
@@ -16,7 +16,6 @@
16
16
  font-weight: normal;
17
17
  color: var(--Dash-Text-Weak);
18
18
  text-align: center;
19
- border-radius: 4px;
20
19
  cursor: default;
21
20
  user-select: none;
22
21
  -webkit-user-select: none;
@@ -37,16 +36,13 @@
37
36
  .dash-datepicker-calendar td:focus {
38
37
  outline: 2px solid var(--Dash-Fill-Interactive-Strong);
39
38
  outline-offset: -2px;
39
+ border-radius: 4px;
40
40
  z-index: 1;
41
41
  position: relative;
42
42
  }
43
43
 
44
44
  .dash-datepicker-calendar td.dash-datepicker-calendar-date-highlighted {
45
- background-color: color-mix(
46
- in srgb,
47
- var(--Dash-Fill-Interactive-Strong) 5%,
48
- transparent 95%
49
- );
45
+ background-color: var(--Dash-Fill-Interactive-Weak);
50
46
  color: var(--Dash-Fill-Interactive-Strong);
51
47
  }
52
48
 
@@ -55,6 +51,28 @@
55
51
  color: var(--Dash-Fill-Inverse-Strong);
56
52
  }
57
53
 
54
+ .dash-datepicker-calendar td.dash-datepicker-calendar-date-selected {
55
+ background-color: var(--Dash-Fill-Interactive-Strong);
56
+ color: var(--Dash-Fill-Inverse-Strong);
57
+ }
58
+
59
+ /* start_date selector: a selected date which is preceded by an unselected date */
60
+ .dash-datepicker-calendar
61
+ td:not(.dash-datepicker-calendar-date-highlighted)
62
+ + td.dash-datepicker-calendar-date-selected {
63
+ border-start-start-radius: 4px;
64
+ border-end-start-radius: 4px;
65
+ }
66
+
67
+ /* end_date selector: a selected date which is followed by an unselected date */
68
+ .dash-datepicker-calendar
69
+ td.dash-datepicker-calendar-date-selected:not(
70
+ :has(+ td.dash-datepicker-calendar-date-highlighted)
71
+ ) {
72
+ border-start-end-radius: 4px;
73
+ border-end-end-radius: 4px;
74
+ }
75
+
58
76
  .dash-datepicker-calendar td.dash-datepicker-calendar-date-disabled {
59
77
  opacity: 0.6;
60
78
  cursor: not-allowed;
@@ -56,6 +56,8 @@
56
56
  padding: 0;
57
57
  background-color: inherit;
58
58
  color: inherit;
59
+ font-family: inherit;
60
+ font-size: inherit;
59
61
  }
60
62
 
61
63
  .dash-datepicker-input::selection,
@@ -68,6 +70,10 @@
68
70
  border: 1px solid var(--Dash-Fill-Interactive-Strong);
69
71
  }
70
72
 
73
+ .dash-datepicker-input-wrapper:has(:focus-visible) {
74
+ outline: 1px solid var(--Dash-Fill-Interactive-Strong);
75
+ }
76
+
71
77
  .dash-datepicker-input-wrapper-disabled {
72
78
  opacity: 0.6;
73
79
  cursor: not-allowed;
@@ -85,33 +91,6 @@
85
91
  color: var(--Dash-Text-Disabled);
86
92
  }
87
93
 
88
- .dash-datepicker-trigger-button {
89
- padding: var(--Dash-Spacing);
90
- background: transparent;
91
- border: none;
92
- border-radius: 4px;
93
- color: var(--Dash-Text-Strong);
94
- cursor: pointer;
95
- }
96
-
97
- .dash-datepicker-trigger-button:hover {
98
- background: var(--Dash-Fill-Weak);
99
- }
100
-
101
- .dash-datepicker-trigger-button:focus-visible {
102
- outline: 2px solid var(--Dash-Fill-Interactive-Strong);
103
- outline-offset: 2px;
104
- }
105
-
106
- .dash-datepicker-trigger-button[aria-expanded='true'] {
107
- background: var(--Dash-Fill-Weak);
108
- }
109
-
110
- .dash-datepicker-trigger-icon {
111
- width: 16px;
112
- height: 16px;
113
- }
114
-
115
94
  .dash-datepicker-caret-icon {
116
95
  color: var(--Dash-Text-Strong);
117
96
  fill: var(--Dash-Text-Strong);
@@ -120,6 +99,12 @@
120
99
  transition: transform 0.15s;
121
100
  }
122
101
 
102
+ .dash-datepicker-range-arrow {
103
+ color: var(--Dash-Text-Strong);
104
+ width: 1em;
105
+ height: 1em;
106
+ }
107
+
123
108
  .dash-datepicker-input-wrapper[aria-expanded='true']
124
109
  .dash-datepicker-caret-icon {
125
110
  transform: rotate(180deg);
@@ -176,22 +161,32 @@
176
161
  display: flex;
177
162
  align-items: center;
178
163
  justify-content: center;
179
- gap: var(--Dash-Spacing);
164
+ gap: calc(var(--Dash-Spacing) * 2);
180
165
  margin-bottom: calc(var(--Dash-Spacing) * 2);
181
- font-size: 14px;
166
+ font-size: inherit;
182
167
  }
183
168
 
184
169
  .dash-datepicker-controls .dash-dropdown {
185
170
  flex: 0 0 auto;
186
- min-width: 122px;
187
- width: auto;
188
171
  margin: 0;
189
172
  }
190
173
 
174
+ .dash-datepicker-month-sizer {
175
+ height: 0;
176
+ grid-area: 1 / 1;
177
+ visibility: hidden;
178
+ pointer-events: none;
179
+ white-space: nowrap;
180
+ padding: 0 24px;
181
+ font-family: inherit;
182
+ font-size: inherit;
183
+ }
184
+
191
185
  .dash-datepicker-controls .dash-input {
192
186
  flex-shrink: 0;
193
187
  flex-grow: 0;
194
- width: 102px;
188
+ min-width: 102px;
189
+ width: calc(5ch + 40px);
195
190
  }
196
191
 
197
192
  .dash-datepicker-controls .dash-input-stepper {
@@ -220,7 +215,6 @@
220
215
 
221
216
  .dash-datepicker-month-nav:focus-visible {
222
217
  outline: 2px solid var(--Dash-Fill-Interactive-Strong);
223
- outline-offset: 2px;
224
218
  }
225
219
 
226
220
  .dash-datepicker-month-nav:disabled {
@@ -8,7 +8,7 @@
8
8
  --Dash-Text-Primary: rgba(0, 18, 77, 0.87);
9
9
  --Dash-Text-Strong: rgba(0, 9, 38, 0.9);
10
10
  --Dash-Text-Weak: rgba(0, 12, 51, 0.65);
11
- --Dash-Text-Disabled: rgba(0, 21, 89, 0.3);
11
+ --Dash-Text-Disabled: rgba(0, 21, 89, 0.6);
12
12
  --Dash-Fill-Primary-Hover: rgba(0, 18, 77, 0.04);
13
13
  --Dash-Fill-Primary-Active: rgba(0, 18, 77, 0.08);
14
14
  --Dash-Fill-Disabled: rgba(0, 24, 102, 0.1);
@@ -8,6 +8,7 @@
8
8
  outline: none;
9
9
  width: 100%;
10
10
  cursor: pointer;
11
+ font-family: inherit;
11
12
  font-size: inherit;
12
13
  overflow: hidden;
13
14
  accent-color: var(--Dash-Fill-Interactive-Strong);
@@ -46,6 +47,7 @@
46
47
 
47
48
  .dash-dropdown:focus {
48
49
  border: 1px solid var(--Dash-Fill-Interactive-Strong);
50
+ outline: 1px solid var(--Dash-Fill-Interactive-Strong);
49
51
  }
50
52
 
51
53
  .dash-dropdown:disabled {
@@ -102,8 +104,11 @@
102
104
 
103
105
  .dash-dropdown-value-count {
104
106
  line-height: 18px;
105
- padding: 0 2px;
107
+ padding: 4px;
108
+ border-radius: 4px;
109
+ color: var(--Dash-Text-Weak);
106
110
  background: var(--Dash-Fill-Weak);
111
+ font-size: 0.875em;
107
112
  }
108
113
 
109
114
  .dash-dropdown-search-container {
@@ -118,12 +123,13 @@
118
123
 
119
124
  .dash-dropdown-search-container:focus-within {
120
125
  border-color: var(--Dash-Fill-Interactive-Strong);
126
+ outline: 1px solid var(--Dash-Fill-Interactive-Strong);
121
127
  }
122
128
 
123
129
  .dash-dropdown-search-icon,
124
130
  .dash-dropdown-clear {
125
- width: calc(var(--Dash-Spacing) * 3);
126
- height: calc(var(--Dash-Spacing) * 3);
131
+ width: 1em;
132
+ height: 1em;
127
133
  }
128
134
 
129
135
  .dash-dropdown-search-container:focus-within .dash-dropdown-search-icon {
@@ -160,6 +166,8 @@
160
166
  color: var(--Dash-Text-Strong);
161
167
  outline: none;
162
168
  padding: 0;
169
+ font-family: inherit;
170
+ font-size: inherit;
163
171
 
164
172
  /* Hide the "x" clear button in search inputs */
165
173
  &::-webkit-search-cancel-button {
@@ -186,11 +194,12 @@
186
194
  background: none;
187
195
  border: none;
188
196
  cursor: pointer;
189
- font-size: 14px;
197
+ font-family: inherit;
198
+ font-size: 0.875em;
190
199
  font-weight: 600;
191
200
  padding: 0;
192
201
  text-decoration: none;
193
- color: var(--Dash-Text-Disabled);
202
+ color: var(--Dash-Text-Weak);
194
203
  white-space: nowrap;
195
204
  accent-color: var(--Dash-Fill-Interactive-Strong);
196
205
  outline-color: var(--Dash-Fill-Interactive-Strong);
@@ -213,6 +222,15 @@
213
222
  box-shadow: 0 -1px 0 0 var(--Dash-Fill-Disabled) inset;
214
223
  }
215
224
 
225
+ .dash-dropdown-option
226
+ .dash-options-list-option-wrapper:has(input[type='radio']) {
227
+ /* radio buttons are used in single-select dropdowns to aid keyboard
228
+ * selection and screen readers, but visually, they are hidden
229
+ */
230
+ width: 0;
231
+ overflow: hidden;
232
+ }
233
+
216
234
  /* Positioning container for the dropdown */
217
235
  .dash-dropdown-wrapper {
218
236
  position: relative;
@@ -19,6 +19,10 @@
19
19
  border: 1px solid var(--Dash-Fill-Interactive-Strong);
20
20
  }
21
21
 
22
+ .dash-input-container:has(:focus-visible) {
23
+ outline: 1px solid var(--Dash-Fill-Interactive-Strong);
24
+ }
25
+
22
26
  .dash-input-container:has(.dash-input-element:disabled) {
23
27
  opacity: 0.6;
24
28
  cursor: not-allowed;
@@ -46,6 +50,8 @@
46
50
  z-index: 1;
47
51
  order: 2;
48
52
  accent-color: var(--Dash-Fill-Interactive-Strong);
53
+ font-family: inherit;
54
+ font-size: inherit;
49
55
  }
50
56
 
51
57
  .dash-input-element::selection,
@@ -139,5 +145,5 @@
139
145
  }
140
146
 
141
147
  input.dash-input-element:invalid {
142
- outline: solid red;
148
+ color: red;
143
149
  }
@@ -4,7 +4,7 @@
4
4
  color: var(--Dash-Text-Strong);
5
5
  cursor: pointer;
6
6
  display: flex;
7
- align-items: center;
7
+ align-items: baseline;
8
8
  user-select: none;
9
9
  }
10
10
 
@@ -19,6 +19,7 @@
19
19
  cursor: not-allowed;
20
20
  }
21
21
 
22
+ .dash-options-list-option-wrapper,
22
23
  .dash-options-list-option-text {
23
24
  display: flex;
24
25
  align-items: center;
@@ -7,14 +7,14 @@
7
7
  touch-action: none;
8
8
  width: 100%;
9
9
  height: 14px;
10
- padding: 18px 0 18px 0;
10
+ padding: 17px 0 17px 0;
11
11
  box-sizing: border-box;
12
12
  /* Override Radix's default margin/padding behavior */
13
13
  --radix-slider-thumb-width: 16px;
14
14
  }
15
15
 
16
16
  .dash-slider-root.has-marks {
17
- padding: 8px 0 28px 0;
17
+ padding: 6px 0 28px 0;
18
18
  }
19
19
 
20
20
  .dash-slider-root[data-orientation='vertical'].has-marks {
@@ -75,7 +75,7 @@
75
75
  }
76
76
 
77
77
  .dash-slider-thumb:focus {
78
- outline: 1px solid var(--Dash-Fill-Interactive-Strong);
78
+ outline: 2px solid var(--Dash-Fill-Interactive-Strong);
79
79
  }
80
80
 
81
81
  .dash-slider-thumb:focus .dash-slider-tooltip,
@@ -210,11 +210,19 @@
210
210
 
211
211
  .dash-range-slider-input {
212
212
  min-width: 5cqw; /* 5% of container width */
213
- max-width: 15cqw; /* 15% of container width */
213
+ max-width: 25cqw; /* 25% of container width */
214
214
  text-align: center;
215
215
  -webkit-appearance: textfield;
216
216
  -moz-appearance: textfield;
217
217
  appearance: textfield;
218
+ font-family: inherit;
219
+ font-size: inherit;
220
+ box-sizing: content-box;
221
+ height: 30px;
222
+ }
223
+
224
+ .dash-range-slider-input:only-of-type {
225
+ max-width: 33cqw;
218
226
  }
219
227
 
220
228
  .dash-range-slider-input::selection,
@@ -224,7 +232,7 @@
224
232
  }
225
233
 
226
234
  .dash-range-slider-input:focus {
227
- outline: none;
235
+ outline: 1px solid var(--Dash-Fill-Interactive-Strong);
228
236
  }
229
237
 
230
238
  /* Hide the number input spinners */
@@ -9,6 +9,16 @@
9
9
  width: 100%;
10
10
  accent-color: var(--Dash-Fill-Interactive-Strong);
11
11
  outline-color: var(--Dash-Fill-Interactive-Strong);
12
+ font-family: inherit;
13
+ font-size: inherit;
14
+ }
15
+
16
+ .dash-textarea:focus-within {
17
+ border: 1px solid var(--Dash-Fill-Interactive-Strong);
18
+ }
19
+
20
+ .dash-textarea:focus-visible {
21
+ outline: 1px solid var(--Dash-Fill-Interactive-Strong);
12
22
  }
13
23
 
14
24
  .dash-textarea:disabled {
@@ -32,7 +32,7 @@
32
32
  background: var(--Dash-Tooltip-Background-Color);
33
33
  white-space: nowrap;
34
34
  z-index: var(--Dash-Tooltip-ZIndex);
35
- pointer-events: none;
35
+ pointer-events: var(--Dash-Tooltip-PointerEvents);
36
36
  box-shadow: 0px 10px 38px -10px var(--Dash-Shading-Strong),
37
37
  0px 10px 20px -15px var(--Dash-Shading-Weak);
38
38
  }
@@ -150,17 +150,23 @@ const DatePickerRange = ({
150
150
  }
151
151
  }, [internalStartDate, internalEndDate, updatemode]);
152
152
 
153
+ const isDateAllowed = useCallback(
154
+ (date?: Date): date is Date => {
155
+ return (
156
+ !!date && !isDateDisabled(date, minDate, maxDate, disabledDates)
157
+ );
158
+ },
159
+ [minDate, maxDate, disabledDates]
160
+ );
161
+
153
162
  const sendStartInputAsDate = useCallback(
154
163
  (focusCalendar = false) => {
155
164
  if (startInputValue) {
156
165
  setInternalStartDate(undefined);
157
166
  }
158
167
  const parsed = strAsDate(startInputValue, display_format);
159
- const isValid =
160
- parsed &&
161
- !isDateDisabled(parsed, minDate, maxDate, disabledDates);
162
168
 
163
- if (isValid) {
169
+ if (isDateAllowed(parsed)) {
164
170
  setInternalStartDate(parsed);
165
171
  if (focusCalendar) {
166
172
  calendarRef.current?.focusDate(parsed);
@@ -178,14 +184,7 @@ const DatePickerRange = ({
178
184
  }
179
185
  }
180
186
  },
181
- [
182
- startInputValue,
183
- display_format,
184
- start_date,
185
- minDate,
186
- maxDate,
187
- disabledDates,
188
- ]
187
+ [startInputValue, display_format, start_date, isDateAllowed]
189
188
  );
190
189
 
191
190
  const sendEndInputAsDate = useCallback(
@@ -194,11 +193,8 @@ const DatePickerRange = ({
194
193
  setInternalEndDate(undefined);
195
194
  }
196
195
  const parsed = strAsDate(endInputValue, display_format);
197
- const isValid =
198
- parsed &&
199
- !isDateDisabled(parsed, minDate, maxDate, disabledDates);
200
196
 
201
- if (isValid) {
197
+ if (isDateAllowed(parsed)) {
202
198
  setInternalEndDate(parsed);
203
199
  if (focusCalendar) {
204
200
  calendarRef.current?.focusDate(parsed);
@@ -216,14 +212,7 @@ const DatePickerRange = ({
216
212
  }
217
213
  }
218
214
  },
219
- [
220
- endInputValue,
221
- display_format,
222
- end_date,
223
- minDate,
224
- maxDate,
225
- disabledDates,
226
- ]
215
+ [endInputValue, display_format, end_date, isDateAllowed]
227
216
  );
228
217
 
229
218
  const clearSelection = useCallback(
@@ -242,15 +231,14 @@ const DatePickerRange = ({
242
231
 
243
232
  const handleStartInputKeyDown = useCallback(
244
233
  (e: React.KeyboardEvent<HTMLInputElement>) => {
245
- if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
234
+ if (['ArrowUp', 'ArrowDown', 'Enter'].includes(e.key)) {
246
235
  e.preventDefault();
247
- sendStartInputAsDate(true);
248
236
  if (!isCalendarOpen) {
249
- // open the calendar after resolving prop changes, so that
250
- // it opens with the correct date showing
251
- setTimeout(() => setIsCalendarOpen(true), 0);
237
+ setIsCalendarOpen(true);
252
238
  }
253
- } else if (['Enter', 'Tab'].includes(e.key)) {
239
+ // Wait for calendar to mount before focusing
240
+ requestAnimationFrame(() => sendStartInputAsDate(true));
241
+ } else if (e.key === 'Tab') {
254
242
  sendStartInputAsDate();
255
243
  }
256
244
  },
@@ -259,15 +247,14 @@ const DatePickerRange = ({
259
247
 
260
248
  const handleEndInputKeyDown = useCallback(
261
249
  (e: React.KeyboardEvent<HTMLInputElement>) => {
262
- if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
250
+ if (['ArrowUp', 'ArrowDown', 'Enter'].includes(e.key)) {
263
251
  e.preventDefault();
264
- sendEndInputAsDate(true);
265
252
  if (!isCalendarOpen) {
266
- // open the calendar after resolving prop changes, so that
267
- // it opens with the correct date showing
268
- setTimeout(() => setIsCalendarOpen(true), 0);
253
+ setIsCalendarOpen(true);
269
254
  }
270
- } else if (['Enter', 'Tab'].includes(e.key)) {
255
+ // Wait for calendar to mount before focusing
256
+ requestAnimationFrame(() => sendEndInputAsDate(true));
257
+ } else if (e.key === 'Tab') {
271
258
  sendEndInputAsDate();
272
259
  }
273
260
  },
@@ -349,10 +336,8 @@ const DatePickerRange = ({
349
336
  onChange={e => setStartInputValue(e.target.value)}
350
337
  onKeyDown={handleStartInputKeyDown}
351
338
  onFocus={() => {
352
- if (internalStartDate) {
353
- calendarRef.current?.setVisibleDate(
354
- internalStartDate
355
- );
339
+ if (isCalendarOpen) {
340
+ sendStartInputAsDate();
356
341
  }
357
342
  }}
358
343
  placeholder={start_date_placeholder_text}
@@ -360,7 +345,7 @@ const DatePickerRange = ({
360
345
  dir={direction}
361
346
  aria-label={start_date_placeholder_text}
362
347
  />
363
- <ArrowIcon />
348
+ <ArrowIcon className="dash-datepicker-range-arrow" />
364
349
  <AutosizeInput
365
350
  inputRef={node => {
366
351
  endInputRef.current = node;
@@ -372,10 +357,8 @@ const DatePickerRange = ({
372
357
  onChange={e => setEndInputValue(e.target.value)}
373
358
  onKeyDown={handleEndInputKeyDown}
374
359
  onFocus={() => {
375
- if (internalEndDate) {
376
- calendarRef.current?.setVisibleDate(
377
- internalEndDate
378
- );
360
+ if (isCalendarOpen) {
361
+ sendEndInputAsDate();
379
362
  }
380
363
  }}
381
364
  placeholder={end_date_placeholder_text}
@@ -401,6 +384,9 @@ const DatePickerRange = ({
401
384
  className="dash-datepicker-content"
402
385
  align="start"
403
386
  sideOffset={5}
387
+ collisionBoundary={containerRef.current?.closest(
388
+ '#_dash-app-content'
389
+ )}
404
390
  onOpenAutoFocus={e => e.preventDefault()}
405
391
  onCloseAutoFocus={e => {
406
392
  e.preventDefault();
@@ -124,15 +124,14 @@ const DatePickerSingle = ({
124
124
 
125
125
  const handleInputKeyDown = useCallback(
126
126
  (e: React.KeyboardEvent<HTMLInputElement>) => {
127
- if (['ArrowUp', 'ArrowDown'].includes(e.key)) {
127
+ if (['ArrowUp', 'ArrowDown', 'Enter'].includes(e.key)) {
128
128
  e.preventDefault();
129
- parseUserInput(true);
130
129
  if (!isCalendarOpen) {
131
- // open the calendar after resolving prop changes, so that
132
- // it opens with the correct date showing
133
- setTimeout(() => setIsCalendarOpen(true), 0);
130
+ setIsCalendarOpen(true);
134
131
  }
135
- } else if (['Enter', 'Tab'].includes(e.key)) {
132
+ // Wait for calendar to mount before focusing
133
+ requestAnimationFrame(() => parseUserInput(true));
134
+ } else if (e.key === 'Tab') {
136
135
  parseUserInput();
137
136
  }
138
137
  },
@@ -204,6 +203,9 @@ const DatePickerSingle = ({
204
203
  className="dash-datepicker-content"
205
204
  align="start"
206
205
  sideOffset={5}
206
+ collisionBoundary={containerRef.current?.closest(
207
+ '#_dash-app-content'
208
+ )}
207
209
  onOpenAutoFocus={e => e.preventDefault()}
208
210
  onCloseAutoFocus={e => {
209
211
  e.preventDefault();