Testing Happy Focus

Happy focus! 😎

A small script (416B gzipped) that responsibly removes focus after a click.

The focus state and its styles will show and retain on click in current Chrome versions or IE >= 9 once you style buttons or inputs away from their defaults. In IE9 specifically, default :focus styles even when not applying custom styles.

Try below. The red border (or any other style you give it) is visible in these browsers on click as well as when using the keyboard to navigate.

It is advised not the use this script on `type="submit"` inputs or buttons, as it breaks native form validation.

Scenario without Happy Focus

Scenario with Happy Focus