Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting the PR, please make sure you do the following
fixes #123
).Description
Problem Solved by This PR
feat(useFileDialog): Attach the element to the DOMs body but making it "invisible and add id to the function config!
Specific Changes
input
Element: To ensure that theinput
element can be accessed normally when using automation testing tools like Playwright, we set CSS styles to make it invisible on the page and then mounted the element to the body node of the DOM. This approach not only ensures that the element does not affect the visual layout of the page but also allows testing tools to interact with it properly.id
Configuration: A newid
option has been added to the function configuration ofuseFileDialog
. Users can use this option to assign a unique id to the created element. This improvement significantly enhances the element's accessibility in assistive tools (such as screen readers), making it more convenient for people with disabilities to use this feature.input
element is removed from the DOM node when thetryOnScopeDispose
scope is destroyed. This operation ensures that the relevant memory resources are released in a timely manner when the component is no longer in use.Additional context
In this PR, please pay special attention to the improvement of the functionality's accessibility brought by the addition of the id configuration, as well as the optimization of memory management through the logic of removing the element when the component is unmounted.