Suppress Link Titles

前端 未结 6 1521
甜味超标
甜味超标 2021-01-13 21:25

Is there any way to suppress the pop-up titles on links, yet still keep them on the page for the visually impaired?

6条回答
  •  不知归路
    2021-01-13 22:13

    I had this issue with a project where the client wanted to display their own tooltip (which was done with CSS) but it was also showing because of the browser-initiated tooltip also, so it showed twice. We got around this by removing the 'title' attribute and instead using 'data' to populate the text in the CSS.

    I'm not sure what you mean as keeping them on the page for the visually impaired, as they're only visible in the source code?

    For example:

    Link title here

    would show the link 'Link title here' on the page as well as the annoying popup when you hover on it.

    Link title here

    would show the link 'Link title here' but would NOT show the annoying popup on hovering, though you can still use the data tag to reference whatever you want to put there (in our case, we put the text for the tooltip for the CSS to refer to).

    Obviously if you remove the title tag completely the issue is resolved, but you said you needed to keep it there so this is my workaround as used before.

提交回复
热议问题