day8 / re-com

A ClojureScript library of reusable components for Reagent
https://re-com.day8.com.au
MIT License
796 stars 147 forks source link

single-dropdown shows focus rectangle when :disabled? true #256

Open hipitihop opened 3 years ago

hipitihop commented 3 years ago

While the dropdown correctly shows disabled background and sans dropdown button, it still shows the focus rectangle when clicked or keyboard navigated to (tab).

image

superstructor commented 3 years ago

This is because:

  1. the browser has default 'user agent' styles for focus like:
    :focus {
    outline: -webkit-focus-ring-color auto 1px;
    }
  2. for 'native input' components such as <input ..> the browser also disables those styles when disabled
  3. [single-dropdown ...] is just a structured of styled div > a > span. Not a 'native input' component.

I attempted adding the disabled attribute to the structure when disabled? is true e.g. <span disabled> etc but it had no impact on the styling.

This will need to be fixed in the future styling changes w/ a class that alters the :focus styles when disabled? is true. Cannot fix at the moment as we cannot change :focus styles with inline styles.