feat: consistent file input behavior on android

オープン
#6,536 コメント 8 件 リアクション 9 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
android, html
領域
mobile, web-dev

調査の方向性

まず、 に対する Android の処理と、accept および capture がどのように解釈されるかを追跡し、次に必要な AndroidManifest.xml の queries エントリを確認します。現在の選択画面の動作を、Android の Chrome および iOS の Capacitor と比較します。要求されたカメラ、ファイルブラウザー、またはアプリ選択画面の動作が機能し、Android マニフェストの要件が文書化されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

platform: android

Feature Request

Description

When using <input type="file"> on Android, allow the user to choose what app to use (e.g. Camera or Files), unless the behavior is restricted by accept or capture attributes.

Current behavior on Android with Capacitor seems to be:

  • If capture attribute is present, and IMAGE_CAPTURE action is defined in AndroidManifest.xml then open the camera,
  • Otherwise open the file browser

This differs from the behavior in Chrome for Android or Capacitor on iOS, both of which let the user choose between multiple apps when the capture attribute isn't set.

Platform(s)
  • Android
Preferred Solution

Show an app chooser an Android depending on the accept and capture properties:

  • If capture attribute is present, then directly open camera
  • If accept attribute is used to only include types that aren't images, then directly open file browser
  • Otherwise show an app chooser, which should include at least Camera and File options

Also document that on Android it's necessary to add the following code to AndroidManifest.xml in order to show the camera from a file input:

    <queries>
        <!-- So camera can be opened from `<input type="file" capture>` -->
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
    </queries>
Alternatives

Document the differences in behavior between Android and web/iOS, as well as a suggested workaround (e,g, implementing a custom action sheet or popover with options for Camera and Files).

Additional Context
主要言語
TypeScript
スター
17.1k
フォーク
1.3k
平均マージ
1日 22時間
マージ済み PR(30日)
26

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ionic-team/capacitor のほかの issue

ionic-team/capacitor の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。