How to remove focus around buttons on click

后端 未结 30 1077
遇见更好的自我
遇见更好的自我 2020-12-02 04:24

My buttons all have a highlight around them after I click them. This is in Chrome.

\"Unselected\"

30条回答
  •  借酒劲吻你
    2020-12-02 05:10

    You can set tabIndex="-1". It will make browser to skip this button when you TAB through focusable controls.

    Other "fixes" suggested here, only remove focus outline, but still leaves buttons tabable. However, from usability point of view, you already removed glow, so your user won't know what is currently focused button, any way.

    On other hand, making button non-tabable have accessibility implications.

    I'm using it to remove focus outline from X button in bootstrap modal, which have duplicate "Close" button at the bottom any way, so my solution have no impact on accessibility.

提交回复
热议问题