Conversation
|
7451c89 to
c4c66a9
Compare
matyasf
left a comment
There was a problem hiding this comment.
Nice work!
I think that this new behaviour is much more logical, than the old one. (and the old one was even buggy in the uncontrolled behaviour because you could clear the field when the value was not cleared.)
But I'm afraid that introducing this as a fix could break our user's code, since until now it was impossible for the component to return '' as value, it always returned a valid date.
So can you please put this behind a new prop, say allowClearingSelection (it should default to false) to make sure we dont break code?
Also we could make this new behaviour the default one in the next major version, so please add this to our v11-upgrade-guide.md.
PS I could clear the input with just keyboard, what is the a11y concern here?
c4c66a9 to
7cf710f
Compare
|
matyasf
left a comment
There was a problem hiding this comment.
as for the a11y issue, if you set
allowClearingSelectiontotrueand clear the input value and pressEnter, it selects the first option. You can still exit the input field with a Tab, but were not sure if tabbing is a usual user behavior in this case
I think that this is fine. We clearly indicate that there is a selection, and Enter confirms it. It might be better if we would not select anything, but thats out of scope for this PR IMO.
ISSUE:
In the TimeSelect component, after explicitly setting a value, it cannot be cleared from the input field. When the value is deleted form the input filed and the input field loses focus, the last selected option is reapplied.
Also the onChange does not trigger when input field is cleared.
TEST PLAN:
test clearing values if allowClearingSelection is not set (should default to false)
test clearing values if allowClearingSelection is true:
other: