Skip to content

Feature Request: Support showDirectoryPicker and showSaveFilePicker in SystemWebChromeClient for WebView 132+ #1776

@nonameShijian

Description

@nonameShijian

Feature Request

Modify the onShowFileChooser method within the SystemWebChromeClient class to implement corresponding folder selection or save functionality when the fileChooserParams parameter is set to MODE_OPEN_FOLDER or MODE_SAVE.

Motivation Behind Feature

In WebView versions 132 and above, resolve the errors where JavaScript's showDirectoryPicker and showSaveFilePicker methods result in "The user aborted a request" responses.

Feature Description

In WebView versions 132 and above, support has been introduced for the following new methods:

  • showDirectoryPicker
  • showSaveFilePicker
  • showOpenFilePicker
    
    I have observed that showOpenFilePicker works correctly, but showDirectoryPicker and showSaveFilePicker return errors indicating "The user aborted a request".
    
    Upon examining the source code, I found that the onShowFileChooser method within the SystemWebChromeClient class can support these functionalities based on the fileChooserParams parameter. However, Cordova currently lacks support for these features.

Are there any drawbacks? Will this break anything for existing users?


It is important to consider potential compatibility issues with existing applications. The implementation should be carefully tested to ensure it does not introduce regressions.

Alternatives or Workarounds

Proposed Solution:
Modify the onShowFileChooser method within the SystemWebChromeClient class so that it implements the appropriate folder selection or save operations when the fileChooserParams parameter indicates MODE_OPEN_FOLDER or MODE_SAVE.

However, I have not attempted this solution myself due to my limited expertise in this area.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions