Skip to content
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

The calciteInputInput event is triggered early causing incorrect status #9581

Open
2 of 6 tasks
DitwanP opened this issue Jun 13, 2024 · 0 comments
Open
2 of 6 tasks
Labels
0 - new New issues that need assignment. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. calcite-components Issues specific to the @esri/calcite-components package. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone needs triage Planning workflow - pending design/dev review.

Comments

@DitwanP
Copy link
Contributor

DitwanP commented Jun 13, 2024

Check existing issues

Actual Behavior

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.

Reproduction Sample

https://codepen.io/Dipali-Joshi/pen/ExzxYaX?editors=1000

Reproduction Steps

  1. Open the sample application using the provided link.
  2. Open the Console in Developer Tools.
  3. 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.
  4. 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.
  5. 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).
  6. We can also observe an error that the ‘files’ property of the input is not defined.
  7. 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

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

N/A

@DitwanP DitwanP added bug Bug reports for broken functionality. Issues should include a reproduction of the bug. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Jun 13, 2024
@github-actions github-actions bot added calcite-components Issues specific to the @esri/calcite-components package. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone labels Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - new New issues that need assignment. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. calcite-components Issues specific to the @esri/calcite-components package. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone needs triage Planning workflow - pending design/dev review.
Projects
None yet
Development

No branches or pull requests

1 participant