-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INSTUI-4429 fix(ui-time-select): clear input field after setting an empty value #1848
INSTUI-4429 fix(ui-time-select): clear input field after setting an empty value #1848
Conversation
|
7451c89
to
c4c66a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as for the a11y issue, if you set
allowClearingSelection
totrue
and 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: