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

Clippings Input Event Not Recorded By ShadowDom #320

Closed
bmteo opened this issue Jan 16, 2021 · 9 comments
Closed

Clippings Input Event Not Recorded By ShadowDom #320

bmteo opened this issue Jan 16, 2021 · 9 comments
Assignees

Comments

@bmteo
Copy link

bmteo commented Jan 16, 2021

Hey there, I'm working with custom components via Vue that are using a ShadowDom. I've run into an issue where clippings does not paste the content into an input or editable div within the shadow dom.

As I understand it, input events are composed, so they should bubble down into the shadow dom, however, I don't think that this is the case for Clippings.

Pasting text from the context menu works, and so does the paste event from ctrl + v, but for some reason the input event emitted by Clippings isn't even being captured.

I've tried isolating the element/document that encapsulates the shadowdom, and printing any input events that occur, and events like context menu paste and keyups work, but again Clippings input events aren't being captured.

I'd appreciate any help!

Ben

@aecreations
Copy link
Owner

Clippings creates and dispatches the input event whenever a "paste" occurs, but the compose property on the event isn't set, so it defaults to false. I can fix that to make the input event composed. Do you have a web page with your custom component that I can test the fix on?

@bmteo
Copy link
Author

bmteo commented Jan 21, 2021

Hey, unfortunately the exact code that I'm working on isn't available but I can make a Codepen with a shadowdom + insertable div and link it here. Give me a moment

P.S. Thank you for the help!

@bmteo
Copy link
Author

bmteo commented Jan 22, 2021

https://codepen.io/wd23/pen/yLarwvb

Let me know if this works for you. I can replicate the issue on my end using it

@aecreations
Copy link
Owner

I've tried setting composed: true on the input event object that is created and dispatched when a clipping is inserted, but that didn't have any effect. I've tested it out in your Codepen snippet, and the clipping is still not being inserted into the "ShadowDom Div" textbox.

Reading through the MDN doc[1], I understand it to mean that setting composed to true on the Event object allows the event to cross the shadow DOM into the standard DOM, but it doesn't say that the reverse is true.

Unless there is something else that can be tried, I'm going to leave it at that for now. I've created a branch in this repo where I've parked the attempted fix.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Event/composed

aecreations added a commit that referenced this issue Jan 22, 2021
… shadown DOM of a custom web component

(issue #320)
@willrpike
Copy link
Contributor

willrpike commented Feb 16, 2021

master...willrpike:patch-2 fixes this bug.

@bmteo
Copy link
Author

bmteo commented Feb 16, 2021

@aecreations Could you try it on the codepen link with @willrpike's changes?

@willrpike
Copy link
Contributor

willrpike commented Feb 16, 2021

Opened a pull request #327

@aecreations
Copy link
Owner

Thanks @willrpike for submitting the fix!

Tested using the above Codepen, as well as my own test HTML page, and the HTML editors found in Gmail, Outlook.com and Yahoo! Mail.

@aecreations aecreations self-assigned this Feb 18, 2021
@aecreations aecreations added this to the 6.2.6 Torrance milestone Feb 18, 2021
aecreations added a commit that referenced this issue Feb 18, 2021
…o branches/6.2

- Pulling in PR for fix for issue #320 into 6.2.x branch
@aecreations
Copy link
Owner

Fixed in Clippings 6.2.6. Release announcement: https://aecreations.blogspot.com/2021/02/clippings-626-released.html

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

3 participants