Skip to content

Commit

Permalink
fix: Allow text selection in date picker and date range picker (#3181)
Browse files Browse the repository at this point in the history
  • Loading branch information
jperals authored Jan 15, 2025
1 parent 8b9979b commit deb8ce1
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 9 deletions.
6 changes: 0 additions & 6 deletions src/date-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ const DatePicker = React.forwardRef(

baseProps.className = clsx(baseProps.className, styles.root, styles['date-picker-container']);

const handleMouseDown = (event: React.MouseEvent) => {
// prevent currently focused element from losing it
event.preventDefault();
};

return (
<div {...baseProps} ref={mergedRef} onKeyDown={!disabled && !readOnly ? onWrapperKeyDownHandler : undefined}>
{disabled || readOnly ? (
Expand All @@ -183,7 +178,6 @@ const DatePicker = React.forwardRef(
stretchHeight={true}
open={isDropDownOpen}
onDropdownClose={onDropdownCloseHandler}
onMouseDown={handleMouseDown}
trigger={trigger}
expandToViewport={expandToViewport}
scrollable={false}
Expand Down
2 changes: 0 additions & 2 deletions src/date-range-picker/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ $calendar-header-color: awsui.$color-text-body-default;
}

.label {
user-select: text;
cursor: default;
}

Expand Down Expand Up @@ -173,7 +172,6 @@ $calendar-header-color: awsui.$color-text-body-default;
}

.dropdown-content {
user-select: text;
background-color: awsui.$color-background-container-content;
inline-size: calc(2 * #{$calendar-grid-width} + #{awsui.$space-xs} + 2 * #{awsui.$space-l});

Expand Down
1 change: 0 additions & 1 deletion src/internal/components/dropdown/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
display: none;
// Needs to be higher than a global navigation element
z-index: 2000;
user-select: none;
transform-origin: top;

// When used in portal we need z-index to be higher than modal's
Expand Down
1 change: 1 addition & 0 deletions src/internal/components/options-list/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
border-start-end-radius: awsui.$border-radius-dropdown;
border-end-start-radius: awsui.$border-radius-dropdown;
border-end-end-radius: awsui.$border-radius-dropdown;
user-select: none;

&-embedded {
border-start-start-radius: 0px;
Expand Down

0 comments on commit deb8ce1

Please sign in to comment.