DEV Community

loading...

Discussion on: 10 trivial yet powerful HTML facts you must know

Collapse
thepeoplesbourgeois profile image
Josh

Great list! It should be noted (unless this has changed since I last read about it) use of the autofocus property is not encouraged because when an element is focused through it, that event is not reported to screen readers.

It would be cool if there was an aria-compatible way of automatically focusing a form field, though! If anyone knows of any (or if my information about autofocus is outdated) I'd love to hear about it!

Collapse
atapas profile image
Tapas Adhikary Author

Hi Josh,

Thanks a lot.

You are right about the accessibility issue with autofocus. One solution is adding the aria-describedby attribute when using it. Thanks for pointing it out.

Forem Open with the Forem app