Skip to content

Get rid of "A11y: Avoid using autofocus" warning #6629

@taw

Description

@taw

Describe the bug

Let's call this warning for what it is - a bug.

autofocus is 100% legitimate feature of HTML5, and just because it can be abused it shouldn't be triggering warnings.

Just some of many websites that use autofocus:

  • google.com
  • bing.com
  • yahoo.com

Warning on something that is key feature a lot of major websites use makes no sense. The alternative of focusing the main input with js is not an improvement at all.

I'm not the first person affected. This has been raised many times in the past, and unreasonably closed without fixing.

Warning systems are useless if most of the warnings are of very low quality like this one; and we should absolutely be getting rid of bad warnings in default configuration. If someone wants to enable extra strict warnings, this should not be default at least.

Reproduction

Legitimately use <input autofocus>, and get this silly warning.

Logs

(!) Plugin svelte: A11y: Avoid using autofocus


### System Info

```shell
System:
    OS: macOS 11.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 60.79 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.2.0 - ~/.nodenv/shims/node
    Yarn: 1.22.0 - /usr/local/bin/yarn
    npm: 7.13.0 - ~/.nodenv/shims/npm
    Watchman: 2021.06.07.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 92.0.4515.131
    Safari: 14.1.1
  npmPackages:
    rollup: ^2.3.4 => 2.56.0
    svelte: ^3.0.0 => 3.42.1


### Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions