Skip to content

Enhance FileInput to recognize user operating system for maxSize calculation #5807

@taysea

Description

@taysea

Expected Behavior

FileInput should recognize what operating system a user is on when determining if 1024 (binary) or 1000 (decimal) should be used as the conversion factor between bytes, KB, etc.

Right now, FileInput uses binary value (1024) of bytes as a conversion factor to determine if a file has exceeded the max size or not. This seems to be the better option (vs decimal conversion factor of 1000) because it ensures that all windows users will experience and accurate comparison between their file browser and Grommet's FileInput. Previously, window's users were being flagged by Grommet's FileInput that their file was too large even though their file browser said it was less than the max size (their file browser used 1024, while grommet used 1000).

While our current solution provides users (regardless of their operating system) with a reasonable experience, it may be nice to enhance FileInput in the future to be slightly more intelligent.

Actual Behavior

URL, screen shot, or Codepen exhibiting the issue

Steps to Reproduce

Your Environment

  • Grommet version:
  • Browser Name and version:
  • Operating System and version (desktop or mobile):

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementA suggestion to add to or change behaviorhacktoberfestPRs submitted in October (open-source celebration month)help wantedWould appreciate community help working on this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions