What is aria-label and how should I use it?

前端 未结 6 2026
隐瞒了意图╮
隐瞒了意图╮ 2020-11-30 16:52

A few hours ago I read about the aria-label attribute, which:

Defines a string value that labels the current element.

But in my

6条回答
  •  遥遥无期
    2020-11-30 17:33

    The title attribute displays a tooltip when the mouse is hovering the element. While this is a great addition, it doesn't help people who cannot use the mouse (due to mobility disabilities) or people who can't see this tooltip (e.g.: people with visual disabilities or people who use a screen reader).

    As such, the mindful approach here would be to serve all users. I would add both title and aria-label attributes (serving different types of users and different types of usage of the web).

    Here's a good article that explains aria-label in depth

提交回复
热议问题