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

Copy snippet action doesn't work without HTTPs #13776

Closed
j3rem1e opened this issue Jan 30, 2021 · 2 comments
Closed

Copy snippet action doesn't work without HTTPs #13776

j3rem1e opened this issue Jan 30, 2021 · 2 comments

Comments

@j3rem1e
Copy link
Contributor

j3rem1e commented Jan 30, 2021

Describe the bug

The button 'copy' snippet doesn't work if storybook is deployed without HTTPs.

It's related to #10526 : navigator.clipboard requires a secure origin.

To Reproduce

  1. Launch a storybook on a non-secure origin (ie, no https and no localhost)
  2. Go to a story snippet and click on the copy button
  3. It fails with the following exception on next and 6.1
Uncaught TypeError: Cannot read property 'writeText' of undefined
    at onClick (syntaxhighlighter.js:204)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
    at invokeGuardedCallback (react-dom.development.js:292)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:306)
    at executeDispatch (react-dom.development.js:389)
    at executeDispatchesInOrder (react-dom.development.js:414)
    at executeDispatchesAndRelease (react-dom.development.js:3278)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js:3287)
    at forEachAccumulated (react-dom.development.js:3259)

System

nvironment Info:

System:
OS: macOS 11.1
CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
Binaries:
Node: 15.6.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.4.0 - /usr/local/bin/npm
Browsers:
Chrome: 88.0.4324.96
Safari: 14.0.2

@shilman
Copy link
Member

shilman commented Feb 2, 2021

Egads!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.0-alpha.20 containing PR #13777 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Feb 2, 2021
@shilman
Copy link
Member

shilman commented Feb 2, 2021

Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.16 containing PR #13777 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants