Skip to content

Commit a34501d

Browse files
authored
fix: set readonly attribute on inputs (#139)
1 parent cb91068 commit a34501d

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

src/components/DateField/hooks/useDateFieldProps.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ export function useDateFieldProps<T = DateTime>(
7474
});
7575

7676
function syncSelectionFromDOM() {
77-
if (state.readOnly) {
78-
setSelectedSections(-1);
79-
return;
80-
}
8177
state.focusSectionInPosition(inputRef.current?.selectionStart ?? 0);
8278
setInnerState({});
8379
}
@@ -192,6 +188,7 @@ export function useDateFieldProps<T = DateTime>(
192188
'aria-describedby': props['aria-describedby'] || undefined,
193189
'aria-details': props['aria-details'] || undefined,
194190
'aria-disabled': state.disabled || undefined,
191+
readOnly: state.readOnly,
195192
inputMode,
196193
onClick() {
197194
syncSelectionFromDOM();

src/components/RangeDatePicker/RangeDatePicker.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ export function RangeDatePicker({className, ...props}: RangeDatePickerProps) {
5656
<TextInput
5757
{...fieldProps}
5858
className={b('field')}
59-
hasClear={fieldProps.hasClear}
6059
endContent={
6160
<React.Fragment>
6261
{!isOnlyTime && (

src/components/RelativeDateField/hooks/useRelativeDateFieldProps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export function useRelativeDateFieldProps(
5454
'aria-describedby': props['aria-describedby'] || undefined,
5555
'aria-details': props['aria-details'] || undefined,
5656
'aria-disabled': state.disabled || undefined,
57+
readOnly: state.readOnly,
5758
},
5859
},
5960
calendarProps: {

src/components/RelativeRangeDatePicker/RelativeRangeDatePicker.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ export function RelativeRangeDatePicker(props: RelativeRangeDatePickerProps) {
140140
role: 'combobox',
141141
'aria-expanded': open,
142142
disabled: isMobile,
143+
readOnly: props.readOnly,
143144
className: b('input', {mobile: isMobile}),
144145
onClick: () => {
145146
if (props.disabled) {

src/components/RelativeRangeDatePicker/components/Zones/Zones.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export function Zones(props: ZonesProps) {
6161
const size = props.isMobile ? 'xl' : props.size;
6262
return (
6363
<Select
64+
disabled={props.disabled}
6465
value={[timeZone]}
6566
options={zones}
6667
size={size}
@@ -82,6 +83,7 @@ export function Zones(props: ZonesProps) {
8283
width="max"
8384
pin="clear-clear"
8485
size={size}
86+
disabled={props.disabled}
8587
extraProps={{
8688
'aria-haspopup': 'listbox',
8789
'aria-expanded': controlProps.open,

0 commit comments

Comments
 (0)