Open onderbakirtas opened 3 years ago
Probably because of this line
A timeout should fix it.
function focus(node) {
setTimeout(() => {
node.focus();
console.log('node: ', node)
console.log('activeElement: ', window.document.activeElement)
console.log('equality: ', node === document.activeElement)
console.log('window: ', window)
}, 0);
}
Probably because of this line
A timeout should fix it.
function focus(node) { setTimeout(() => { node.focus(); console.log('node: ', node) console.log('activeElement: ', window.document.activeElement) console.log('equality: ', node === document.activeElement) console.log('window: ', window) }, 0); }
Thanks for taking your time to investigate the issue. Yeah, probably since sometimes with a hard refresh, I could see a glimpse of focus on the input. Should it be fixed by framework or we need to accept this and move on?
Describe the bug As in the title,
use:action
directive does not work as described in the docs, at least in my case. I want my input to be focused when it's loaded, this works in Svelte app but does not work in Sapper.Logs Log image 1 Log image 2
To Reproduce Create an input element with
use:focus
directive. Thefocus
method have following code:Expected behavior The input should have focus.
Information about your Sapper Installation:
npx envinfo --system --npmPackages svelte,sapper,rollup,webpack --binaries --browsers
Your browser I'm using Chrome and Firefox, both latest versions.
Your hosting environment (i.e. Local, GCP/AWS/Azure, Vercel/Begin, etc...) Currently it's local environment.
If it is an exported (
npm run export
) or dynamic application No, it's working on local vianpm run dev
.Severity Annoying, also it is needed since
autofocus
attribute on input element does not work either.