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 trigger events on the login button #17

Open
rmeissn opened this issue Oct 2, 2019 · 2 comments
Open

Can't trigger events on the login button #17

rmeissn opened this issue Oct 2, 2019 · 2 comments
Assignees

Comments

@rmeissn
Copy link

rmeissn commented Oct 2, 2019

I wasn't able to trigger e.g. a click event on the login buttons root component.

Why do I want to do this?
I use different menus for login and logout actions. Thus I included the login button as a hidden component to the DOM and used my own buttons/menus to trigger click events on this hidden button.
So I'd like to execute document.getElementById('signin').click(), which didn't work.
I was able to achieve my expected behaviour by executing (vue.js syntax) this.$refs.signin.shadowRoot.children[1].click(). This doesn't seems stable and I guess this is not the expected usage of web components....

@rmeissn rmeissn changed the title Can't trigger events to the login button Can't trigger events on the login button Oct 2, 2019
@Michi03
Copy link
Collaborator

Michi03 commented Oct 14, 2019

The button has the _handleClick function (in code here). You may want to try if this works for you, I use it in the statusbar here

@rmeissn
Copy link
Author

rmeissn commented Oct 14, 2019

Thanks for pointing me to this function. I ignored it in the first place because _ seemed like a (inofficial) private function. Using this function works for my use-case.
Nevertheless, the correct way for a button (even though it is a web component) would be to issue a click event to the component, instead of calling a function that (most probably) emulates an internal click event. This should be easily addible without breaking the currently provided functions.

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

3 participants