feat: add condition to allow more input types

This commit is contained in:
Machiel 2024-04-18 14:13:32 +02:00
parent 1636018a86
commit d8989be10f

View File

@ -77,7 +77,23 @@ const TextInput = ({
const cStart = event.target.selectionStart;
const cEnd = event.target.selectionEnd;
runAfterUpdate(() => {
event.target.setSelectionRange(cStart, cEnd);
// Allows for input types that don't support SelectionRange
if (
![
'email',
'date',
'datetime-local',
'month',
'number',
'time',
'week',
'range',
'color',
'file',
].includes(properties.type)
) {
event.target.setSelectionRange(cStart, cEnd);
}
});
})
}