storybookjs/storybook

Storybook Interactions File upload causes dialog to open

已关闭

#17,882 创建于 2022年4月5日

 (3 条评论) (0 个反应) (0 位负责人)TypeScript (10,058 个派生)batch import
addon: interactionsbughelp wantedsev:S3

仓库指标

星标
 (89,909 个星标)
PR 合并指标
 (平均合并 7天 22小时) (30 天内合并 184 个 PR)

描述

Describe the bug When using storybook and @storybook/addon-interactions, a userEvent.upload(<element>, file) causes the file upload dialog to appear even though the file was already uploaded by the interaction.

To Reproduce Reproduction repository: https://github.com/ice1080/storybook-upload-issue-repro (see note below for why I was unable to publish the repo)

System

$ npx sb@next info

Environment Info:

  System:
    OS: Linux 5.16 Pop!_OS 21.10
    CPU: (20) x64 Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz
  Binaries:
    Node: 12.18.2 - ~/.nvm/versions/node/v12.18.2/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 8.5.1 - ~/.nvm/versions/node/v12.18.2/bin/npm
  Browsers:
    Chrome: 99.0.4844.84
    Firefox: 98.0.2
  npmPackages:
    @storybook/addon-actions: ^6.4.9 => 6.4.9 
    @storybook/addon-essentials: ^6.4.9 => 6.4.9 
    @storybook/addon-interactions: ^6.4.19 => 6.4.19 
    @storybook/addon-links: ^6.4.9 => 6.4.9 
    @storybook/builder-webpack5: ^6.4.9 => 6.4.9 
    @storybook/manager-webpack5: ^6.4.9 => 6.4.9 
    @storybook/react: ^6.4.9 => 6.4.9 
    @storybook/testing-library: ^0.0.9 => 0.0.9 

Additional context Steps to see this issue: Run storybook in the repro repo above. Click on the "Test Input" story, wait two seconds, the open file dialog is opened, even though the file in the story was uploaded to the input successfully. This causes the rest of the interactions in the story to be hidden. Note that this only happens when the user manually clicks on the story from a different story. If the component or story is changed and storybook refreshes that story, this behavior does not occur.

Assumed expected behavior: File upload successfully sets the file on the input without opening the manual select dialog.

Side note: I tried to publish the repo using the steps described in the how-to-reproduce, following it exactly, and ran into this error when running the npx chromatic command:

sh: 1: chroma: not found

and the apt version of chroma is a game that is unrelated to the command trying to be run.

贡献者指南