-
Notifications
You must be signed in to change notification settings - Fork 93
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
Focus remains on button #9
Comments
Hi @shikkaba You can do it by yourself. const moveTo = new MoveTo();
const trigger = document.getElementsByClassName('js-trigger')[0];
moveTo.registerTrigger(trigger, function(target){
trigger.blur();
if (target instanceof HTMLElement) {
target.focus();
}
}); Thank you. |
Thank you for writing this, but I'm just saying that this would be a good thing to have in the script as well. |
Hi @shikkaba Thank you for your sugesstion but, I am not sure this is a task that the plugin should do. I dont want to make this plugin complicated. I want to keep it simple and lightweight. Thank you. |
@hsnaydd by "not making it complicated" you make it even more complicated for others people to use. The code above doesn't work for me. const moveTo = new MoveTo()
const triggers = document.getElementsByClassName('js-trigger')
for (var i = 0; i < triggers.length; i++) {
moveTo.registerTrigger(triggers[i], function (target) {
triggers[i].blur()
if (target instanceof HTMLElement) {
target.focus()
}
})
}
Thank you. |
Callback doesn't return an element in the loop. It return |
Hi @iamdubx |
@hsnaydd sure, here - https://jsfiddle.net/Ltstnk0s/ |
Hi @iamdubx Check this; |
Clicking on the button in your demo does indeed bring you back to top visually, but the focus remains on the button. The focus should move to wherever the page visually scrolls to instead of staying with the button clicked.
The text was updated successfully, but these errors were encountered: