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

Shadow DOM problem/suggestion #853

Closed
samvasko opened this issue May 23, 2013 · 4 comments
Closed

Shadow DOM problem/suggestion #853

samvasko opened this issue May 23, 2013 · 4 comments

Comments

@samvasko
Copy link

Hi!
I am currently finishing porting my extension to use Shadow DOM. I was wrestling with the same issue like vimium, where css of page I was injecting into has been modifying css of the extension. Shadow DOM separates extension from other styles, Very neat.

But when I have Input element inside of #documet-fragment vimium still reacts to typing like I am not in input.
Example on JsBin

if you want to check my extension. It is in Slovak, but code is in English.

@JoelBesada
Copy link

I ran into this same issue on an extension I'm developing using the Shadow DOM. Since Vimium uses document.activeElement, which points to the Shadow DOM root element and not the actual element inside, it cannot see that the user is actually typing into an input element.

I managed to work around this by adding the contenteditable attribute to the Shadow DOM root element, which marks it as an input element. It would be great however if there was some other Vimium specific class or property that could be set on the Shadow DOM root to mark it as an input element.

@philc
Copy link
Owner

philc commented Apr 23, 2014

Interesting, thanks for the research guys. So is the contract change you're proposing is that vimium support a pre-defined, special classname to mark a node as editable? What parts of vimium would need to support that?

@mrmr1993
Copy link
Contributor

mrmr1993 commented May 1, 2015

The example above no longer works now Element.webkitCreateShadowRoot has been depreciated. Updated example here.

We can detect that an element has a shadow root by checking that element.shadowRoot != null, and further can capture focus events after one fires on the shadow root with element.shadowRoot.addEventListener("focus", listener, true). Tying this together, we should be able to activate input mode for shadow DOM elements to kill this bug.

@mrmr1993
Copy link
Contributor

This was fixed by #1627.

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

No branches or pull requests

5 participants