Remove blue border from css custom-styled button in Chrome

前端 未结 22 996
闹比i
闹比i 2020-11-22 17:10

I\'m working on a web page, and I want custom-styled

22条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 17:33

    Until all modern browsers will start support css-selector :focus-visible,
    the simplest and possibly best way to save accessibility is to remove this tricky focus only for mouse users and to save it for keyboard users:

    1.Use this tiny polyfill (about 10kb): https://github.com/WICG/focus-visible
    2.Add next code somewhere in your css:

    .js-focus-visible :focus:not(.focus-visible) {
      outline: none;
    }
    

    Browser-support of css4-selector :focus-visible right now very weak:
    https://caniuse.com/#search=focus-visible

提交回复
热议问题