VolkerE has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372039 )

Change subject: WikimediaUI theme: Make checkbox/radio code leaner
......................................................................

WikimediaUI theme: Make checkbox/radio code leaner

Making Checkbox- and RadioInputWidget's code leaner by
reordering pseudo-classes and therefore removing
unnecessary specificity overrides.

Change-Id: Ia60a7953a4c1dad64616f974f24cc901aa2921e9
---
M src/themes/wikimediaui/widgets.less
1 file changed, 31 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/39/372039/1

diff --git a/src/themes/wikimediaui/widgets.less 
b/src/themes/wikimediaui/widgets.less
index 64160af..e33e5b0 100644
--- a/src/themes/wikimediaui/widgets.less
+++ b/src/themes/wikimediaui/widgets.less
@@ -400,21 +400,20 @@
                        );
                }
 
-               &:hover + span,
-               &:focus:hover + span {
-                       border-color: @color-progressive;
-               }
-
-               &:active + span,
-               &:active:focus + span {
-                       background-color: @color-progressive--active;
-                       border-color: @border-color-input-binary--active;
-                       box-shadow: @box-shadow-input-binary--active;
-               }
-
+               // `:focus` has to come first, otherwise a specificity race 
with `:hover:focus` etc is necessary
                &:focus + span {
                        border-color: @color-progressive;
                        box-shadow: @box-shadow-widget--focus;
+               }
+
+               &:hover + span {
+                       border-color: @color-progressive;
+               }
+
+               &:active + span {
+                       background-color: @color-progressive--active;
+                       border-color: @border-color-input-binary--active;
+                       box-shadow: @box-shadow-input-binary--active;
                }
 
                &:checked {
@@ -423,24 +422,21 @@
                                border-color: 
@border-color-input-binary--checked;
                        }
 
-                       &:hover + span,
-                       &:focus:hover + span {
-                               background-color: @color-progressive--hover;
-                               border-color: @color-progressive--hover;
-                       }
-
-                       &:active + span,
-                       &:active:hover + span,
-                       &:active:focus + span {
-                               background-color: 
@background-color-input-binary--active;
-                               border-color: 
@border-color-input-binary--active;
-                               box-shadow: @box-shadow-input-binary--active;
-                       }
-
                        &:focus + span {
                                background-color: 
@background-color-input-binary--checked;
                                border-color: 
@border-color-input-binary--checked;
                                box-shadow: @box-shadow-progressive--focus;
+                       }
+
+                       &:hover + span {
+                               background-color: @color-progressive--hover;
+                               border-color: @color-progressive--hover;
+                       }
+
+                       &:active + span {
+                               background-color: 
@background-color-input-binary--active;
+                               border-color: 
@border-color-input-binary--active;
+                               box-shadow: @box-shadow-input-binary--active;
                        }
                }
        }
@@ -1252,24 +1248,23 @@
                                border-color: 
@border-color-input-binary--checked;
                        }
 
-                       &:hover + span,
-                       &:hover:focus + span {
+                       // `:focus` has to come first, otherwise a specificity 
race with `:hover:focus` etc is necessary
+                       &:focus + span {
+                               &:before {
+                                       border-color: @background-color-base;
+                               }
+                       }
+
+                       &:hover + span {
                                border-color: @color-progressive--hover;
                        }
 
-                       &:active + span,
-                       &:active:focus + span {
+                       &:active + span {
                                border-color: 
@border-color-input-binary--active;
                                box-shadow: @box-shadow-input-binary--active;
 
                                &:before {
                                        border-color: 
@border-color-input-binary--active;
-                               }
-                       }
-
-                       &:focus + span {
-                               &:before {
-                                       border-color: @background-color-base;
                                }
                        }
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/372039
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia60a7953a4c1dad64616f974f24cc901aa2921e9
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: VolkerE <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to