When a file is uploaded using the calcite-input component, the status property does not change from invalid to valid as expected, even though the file upload is successful. This is because the event listener for the calciteInputInput event triggers before the file upload completes, causing the input status to remain invalid. Adding a timeout resolves the issue, indicating a timing problem with the event trigger.
Expected Behavior
The timing of the even triggering should be adjusted so that the input status can correctly reflect the current state.
Open the sample application using the provided link.
Open the Console in Developer Tools.
Observe that the ‘validation-message’ “Invalid File” is displayed because the ‘status’ property of the calcite-input element at line 10 is set to ‘invalid’ as a default.
An event listener triggered by the ‘calciteInputInput’ event is added to the input element, which checks the ‘value’ of the input to change the status to ‘valid’ once a file has been uploaded.
Choose and upload a file using the input and observe that the status does not change even though the ‘value’ property has a value (seen in the console log).
We can also observe an error that the ‘files’ property of the input is not defined.
Now uncomment line 14 and 23 to add a timeout to the code. Observe that this time the status changes successfully.
Reproduction Version
2.8.0
Relevant Info
Logged as BUG-000167336
Regression?
No response
Priority impact
impact - p2 - want for an upcoming milestone
Impact
No response
Calcite package
[X] @esri/calcite-components
[ ] @esri/calcite-components-angular
[ ] @esri/calcite-components-react
[ ] @esri/calcite-design-tokens
[ ] @esri/eslint-plugin-calcite-components
Esri team
N/A
The calciteInputInput event is triggered early in Calcite Design System version 2.8.0.
Observe that the ‘validation-message’ “Invalid File” is displayed because the ‘status’ property of the calcite-input element at line #10 is set to ‘invalid’ as a default.
An event listener triggered by the ‘calciteInputInput’ event is added to the input element, which checks the ‘value’ of the input to change the status to ‘valid’ once a file has been uploaded.
Choose and upload a file using the input and observe that the status does not change even though the ‘value’ property has a value (seen in the console log).
We can also observe an error that the ‘files’ property of the input is not defined.
Now uncomment 14 and 23 to add a timeout to the code. Observe that this time the status changes successfully.
This indicates that the event triggers before the file upload is successful, which in this workflow causes the input status to remain invalid even though the file upload is successful.
Note:
1. The” Invalid File” status is used to clarify that the event is triggering too early.
Repro Data: (n/a) Work Around: (n/a) Product: Calcite Design System Functional Category: Calcite Design System Client Platform: (n/a) Version Found: N/A Planned Version Fixed: (n/a) Comment: (n/a)
Check existing issues
Actual Behavior
When a file is uploaded using the
calcite-input
component, thestatus
property does not change frominvalid
tovalid
as expected, even though the file upload is successful. This is because the event listener for thecalciteInputInput
event triggers before the file upload completes, causing the input status to remain invalid. Adding a timeout resolves the issue, indicating a timing problem with the event trigger.Expected Behavior
The timing of the even triggering should be adjusted so that the input
status
can correctly reflect the current state.Reproduction Sample
https://codepen.io/Dipali-Joshi/pen/ExzxYaX?editors=1000
Reproduction Steps
calcite-input
element at line10
is set to ‘invalid’ as a default.14
and23
to add a timeout to the code. Observe that this time the status changes successfully.Reproduction Version
2.8.0
Relevant Info
Logged as
BUG-000167336
Regression?
No response
Priority impact
impact - p2 - want for an upcoming milestone
Impact
No response
Calcite package
Esri team
N/A
Salesforce Submitter: Dipali Joshi
Salesforce Submit Date: 5/08/2024 10:41 PM
Salesforce Bug Type: Failure/Error
Salesforce Severity: Medium
Steps to Repro:
Steps to Reproduce:
Note:
1. The” Invalid File” status is used to clarify that the event is triggering too early.
Repro Data: (n/a)
Work Around: (n/a)
Product: Calcite Design System
Functional Category: Calcite Design System
Client Platform: (n/a)
Version Found: N/A
Planned Version Fixed: (n/a)
Comment: (n/a)