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

Support the HTMLInputElement:webkitdirectory API #422

Merged
merged 28 commits into from
Jul 14, 2023

Conversation

Jaifroid
Copy link
Member

@Jaifroid Jaifroid commented Jul 9, 2023

Fixes #421.

@Jaifroid Jaifroid added enhancement upstream Should be worked on in kiwix-js user interface UI issues labels Jul 9, 2023
@Jaifroid Jaifroid added this to the Release 2.6.0 milestone Jul 9, 2023
@Jaifroid Jaifroid self-assigned this Jul 9, 2023
@Jaifroid
Copy link
Member Author

Jaifroid commented Jul 9, 2023

Tested and working well on Firefox and Edge Legacy.

Doesn't interfere with IE11 legacy file picking, and doesn't prevent use of newer APIs if available.

Need to check interaction with Electron and NWJS.

TODO: put repeated code into a function.

@Jaifroid
Copy link
Member Author

It seems the API has poor support on Android even though webkitdirectory is reported as available.

@Jaifroid
Copy link
Member Author

No support on any mobile browser: https://caniuse.com/input-file-directory.

@Jaifroid
Copy link
Member Author

Jaifroid commented Jul 10, 2023

Prevented false-positive detection on iOS and Android, and tested on BrowserStack.

@Jaifroid
Copy link
Member Author

I've now made a single function to process a directory of files, whether it is provided by webkitdirectory or by File System Access API.

It would be nice if the list of files were retained and displayed on reload of the app. Assuming this is possible (it's just a cookie list), then clidking on a file in the list should open the directory picker in Firefox. This would put us at near parity between the two APIs.

@Jaifroid
Copy link
Member Author

Last thing to do is make it so refresh button opens directory dialogue.

@Jaifroid
Copy link
Member Author

Jaifroid commented Jul 11, 2023

Checks:

  • IE11
  • Edge Legacy
  • UWP (gives message about missing dragged archive twice - once on load, once when picking a folder, but it's minor)
  • Firefox 45 - as expected, only in jQuery mode, and user has to switch to it manually (see README.md)
  • Firefox 60
  • Chrome 49 on Windows XP
  • Chrome 50
  • Modern Firefox
  • Modern Chromium (Edge)
  • Electron on Windows
  • Electron on Linux
  • PWA on iPad
  • PWA on iPhone
  • PWA on Android
  • NWJS on modern Windows
  • NWJS for Windows XP

@Jaifroid Jaifroid linked an issue Jul 13, 2023 that may be closed by this pull request
@Jaifroid
Copy link
Member Author

Jaifroid commented Jul 14, 2023

All manual test passed. Ready to merge. One minor issue noted above has been noted in #427.

@Jaifroid Jaifroid merged commit 759d59b into main Jul 14, 2023
4 checks passed
@Jaifroid Jaifroid deleted the Add-support-for-webkitdirectory-API branch July 14, 2023 10:25
@Jaifroid Jaifroid modified the milestones: Release 2.6.0, Release 2.5.6 Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement upstream Should be worked on in kiwix-js user interface UI issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove circular dependency Add support for HTMLInputElement:webkitdirectory API (principally for Firefox)
1 participant