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

Can't paste values through CMD+V in Safari Mac 13.0.5 #31

Closed
helloatilla opened this issue Feb 13, 2020 · 5 comments · Fixed by #32
Closed

Can't paste values through CMD+V in Safari Mac 13.0.5 #31

helloatilla opened this issue Feb 13, 2020 · 5 comments · Fixed by #32
Labels
bug Something isn't working

Comments

@helloatilla
Copy link

Hi there,

like stated in the subject I can't paste a hex value into the input fields with a CMD+V shortcut in Safari 13.0.5. I'm running Safari on Mojave.

Best regards,
Atilla

@CoreyGinnivan CoreyGinnivan added the bug Something isn't working label Feb 14, 2020
@aesyondu
Copy link
Contributor

aesyondu commented Feb 22, 2020

Confirmed. Mac OS X 10.14.6 here.

CMD + v works in:

  • Google Chrome 80.0.3987.116 (Official Build) (64-bit)
  • Firefox 74.0b6

I wonder what it could be.

@aesyondu
Copy link
Contributor

Here are my findings:

In src/components/control/background.js, the first HexWrapper:

        onKeyPress={e => {
          console.log(123, e)
          const result = e.key.match(/[^0-9a-fA-F]/)
          console.log(444, result)
          if (result) {
            e.preventDefault()
          }
        }}
        onPaste={e => {
          console.log(456, e)
          const text = e.clipboardData.getData('Text')
          e.preventDefault()
          if (chroma.valid(text)) {
            setBackground(
              chroma(text)
                .alpha(1)
                .hex()
                .replace('#', ''),
            )
          }
        }}

Google Chrome outputs:

456 Class {dispatchConfig: {}, _targetInst: FiberNode, nativeEvent: ClipboardEvent, type: "paste", target: input.css-dwtz5p-HexWrapper.elv6yn64, …}

Safari outputs:

[Log] 123  Class {dispatchConfig: {phasedRegistrationNames: {bubbled: "onKeyPress", captured: "onKeyPressCapture"}, dependencies: ["keypress"], eventPriority: 0}, _targetInst: FiberNode, _dispatchListeners: function,} (commons.js, line 67529)
Class {dispatchConfig: {phasedRegistrationNames: {bubbled: "onKeyPress", captured: "onKeyPressCapture"}, dependencies: ["keypress"], eventPriority: 0}, _targetInst: FiberNode, _dispatchListeners: function, _dispatchInstances: FiberNode, nativeEvent: KeyboardEvent,}Class
[Log] 444  ["v"] (1) (commons.js, line 67529)

I'm not sure why they take different code paths.

@aesyondu
Copy link
Contributor

aesyondu commented Feb 22, 2020

@aesyondu
Copy link
Contributor

Temporary workaround:
Right click > Paste

@CoreyGinnivan
Copy link
Owner

Absolute legend, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants