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

A11y warning: Avoid using autofocus #19

Open
j-hannes opened this issue Oct 13, 2019 · 1 comment
Open

A11y warning: Avoid using autofocus #19

j-hannes opened this issue Oct 13, 2019 · 1 comment

Comments

@j-hannes
Copy link

When running the application, a warning appears in the console:

rollup v1.7.3
bundles src/main.js → public/bundle.js...
(!) svelte plugin: A11y: Avoid using autofocus
src/TodoMVC.svelte
92:     on:keydown={createNew}
93:     placeholder="What needs to be done?"
94:     autofocus
        ^
95:   >
96: </header>
src/TodoMVC.svelte
117:               on:keydown={handleEdit}
118:               on:blur={submit}
119:               autofocus
                   ^
120:             >
121:           {/if}
created public/bundle.js in 369ms

[2019-10-13 10:47:46] waiting for changes...
@Mathnerd314
Copy link

Seems there is some argument over it, sveltejs/svelte#6629, because it is not browser-native (it is handled by Svelte explicitly calling focus). The solutions are server-side rendering and letting the browser handle it, or else carefully customizing behavior based on device characteristics like in huggingface/chat-ui#183. But mostly, it should just be disabled by adding <!-- svelte-ignore a11y-autofocus -->

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

2 participants