The purpose of using “aria-labelledby” on already labeled input elements?

后端 未结 2 1329
醉酒成梦
醉酒成梦 2021-02-01 00:05

Many ARIA demonstration websites use code such as:




        
2条回答
  •  萌比男神i
    2021-02-01 00:58

    There's some good examples of its use at Mozilla Developer pages. Perhaps the best of their examples is where it's used to associate a popup menu with the parent menu item - it's Example 7 in the page:

    Open
    Save
    Save as ...
    ...
    ...

    ARIA attributes tends to be of greatest use in building Accessible Rich Internet Applications: so long as you're sticking with standard semantic HTML - using forms with standards labels - you shouldn't need it at all: so there's no reason to use it on a LABEL/INPUT pair. But if you're building "rich UI" from scratch (DIVs and other low level elements with javascript adding interactivity), then it's essential for letting a screenreader know what the higher-level intent is.

提交回复
热议问题