Tradeshift / tradeshift-ui

The Tradeshift UI Library & Framework
https://ui.tradeshift.com
Other
33 stars 45 forks source link

Date Input supports typing characters and deleting selected date #919

Open MirelaPaun opened 4 years ago

MirelaPaun commented 4 years ago

Describe the bug Date Input supports typing characters and deleting selected date by pressing DELETE or BACKSPACE keys from the keyboard

To reproduce

Expected behavior Date Input shouldn't be manipulated, once a date is selected, the input should be readonly.

Framework usage React 16.8.6 TS UI Comp 12.3.6

Desktop (please complete the following information):

Additional context Add any other context about the problem here. image

apasare commented 3 years ago

The reason why this is happening is because when you click on a label the focus is provided to the label's first visible child input element. In this case the first visible element is the original input, which is pseudo-hidden(width: 0; height: 0) - you can check this by typing document.activeElement into console.

One quick solution on your side, until this is fixed in ts-ui, would be to add the following css rule to properly hide the element:

.ts-form .ts-dateinput {
    display: none;
}
MirelaPaun commented 3 years ago

@lauratanase please check this issue too. It seems that other teams are also having issues with input type date. Thank you