Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(chore): optional outline on focus #2801

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/definitions/collections/form.less
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@
font-family: @inputFont;
line-height: @textAreaLineHeight;
resize: @textAreaResize;
&:focus when not (@textAreaFocusOutline = none) {
outline: @textAreaFocusOutline;
}
}
.ui.form textarea:not([rows]) {
height: @textAreaHeight;
Expand Down Expand Up @@ -424,6 +427,9 @@
border-radius: @inputFocusBorderRadius;
background: @inputFocusBackground;
box-shadow: @inputFocusBoxShadow;
& when not (@inputFocusOutline = none) {
outline: @inputFocusOutline;
}
}
& when (@variationInputAction) {
.ui.form .ui.action.input:not([class*="left action"]) {
Expand Down
3 changes: 3 additions & 0 deletions src/definitions/elements/button.less
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
color: @focusColor;
background-image: @focusBackgroundImage;
box-shadow: @focusBoxShadow;
& when not (@focusOutline = none) {
outline: @focusOutline;
}
}

.ui.button:focus .icon {
Expand Down
3 changes: 3 additions & 0 deletions src/definitions/elements/input.less
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
transition: @iconTransition;
cursor: pointer;
}
&:focus when not (@focusOutline = none) {
outline: @focusOutline;
}
}

/* --------------------
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/calendar.less
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

.ui.calendar .calendar:focus,
.ui.calendar.popup:focus {
outline: 0;
outline: @focusOutline;
}

/*******************************
Expand Down
9 changes: 9 additions & 0 deletions src/definitions/modules/checkbox.less
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
font-size: @relativeMedium;
line-height: @checkboxLineHeight;
min-width: @checkboxSize;
&:focus when not (@focusOutline = none) {
outline: @focusOutline;
}
}

/* HTML Checkbox */
Expand All @@ -50,6 +53,9 @@
z-index: 3;
width: @checkboxSize;
height: @checkboxSize;
&:focus when not (@inputFocusOutline = none) {
outline: @inputFocusOutline;
}
}

.ui.checkbox label {
Expand All @@ -58,6 +64,9 @@
display: block;
outline: none;
font-size: @labelFontSize;
&:focus when not (@labelFocusOutline = none) {
outline: @labelFocusOutline;
}
}

.ui.checkbox:not(.invisible) label {
Expand Down
17 changes: 16 additions & 1 deletion src/definitions/modules/dropdown.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
transition: @transition;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
&:focus when not (@focusOutline = none) {
outline: @focusOutline;
}
}

/*******************************
Expand Down Expand Up @@ -59,6 +62,9 @@
transition: @menuTransition;
z-index: @menuZIndex;
will-change: transform, opacity;
&:focus when not (@menuFocusOutline = none) {
outline: @menuFocusOutline;
}
}

.ui.dropdown .menu > * {
Expand Down Expand Up @@ -387,7 +393,7 @@ select.ui.dropdown {
word-wrap: break-word;
line-height: 1em;
white-space: normal;
outline: 0;
outline: none;
transform: rotateZ(0);
min-width: @selectionMinWidth;
min-height: @selectionMinHeight;
Expand All @@ -399,6 +405,9 @@ select.ui.dropdown {
border: @selectionBorder;
border-radius: @selectionBorderRadius;
transition: @selectionTransition;
&:focus when not (@selectionFocusOutline = none) {
outline: @selectionFocusOutline;
}
}
.ui.selection.dropdown.visible,
.ui.selection.dropdown.active {
Expand Down Expand Up @@ -448,6 +457,9 @@ select.ui.dropdown {
width: @menuMinWidth;
box-shadow: @selectionMenuBoxShadow;
transition: @selectionMenuTransition;
&:focus when not (@selectionMenuFocusOutline = none) {
outline: @selectionMenuFocusOutline;
}
}
.ui.selection.dropdown:not(.pointing):not(.floating) .menu {
border-top-width: 0;
Expand Down Expand Up @@ -705,6 +717,9 @@ select.ui.dropdown {
outline: none;
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
padding: inherit;
&:focus when not (@searchFocusOutline = none) {
outline: @searchFocusOutline;
}
}

/* Text Layering */
Expand Down
6 changes: 6 additions & 0 deletions src/definitions/modules/flyout.less
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
z-index: @topLayer;
background: #fff;
outline: none;
&:focus when not (@focusOutline = none) {
outline: @focusOutline;
}
}

/* GPU Layers for Child Elements */
Expand Down Expand Up @@ -71,6 +74,9 @@
opacity: 1;
outline: none;
}
.ui.flyout > .close:focus when not (@closeFocusOutline = none) {
outline: @closeFocusOutline;
}

/* --------------
Header
Expand Down
6 changes: 6 additions & 0 deletions src/definitions/modules/modal.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
user-select: text;
will-change: top, left, margin, transform, opacity;
outline: none;
&:focus when not (@focusOutline = none) {
outline: @focusOutline;
}
}

.ui.modal > :first-child:not(.close):not(.dimmer),
Expand Down Expand Up @@ -80,6 +83,9 @@
opacity: 1;
outline: none;
}
.ui.modal > .close:focus when not (@closeFocusOutline = none) {
outline: @closeFocusOutline;
}

/* --------------
Header
Expand Down
3 changes: 3 additions & 0 deletions src/definitions/modules/search.less
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@
border-color: @promptFocusBorderColor;
background: @promptFocusBackground;
color: @promptFocusColor;
& when not (@focusOutline = none) {
outline: @focusOutline;
}
}

& when (@variationSearchLoading) {
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/modules/slider.less
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

.ui.slider:not(.checkbox):focus {
outline: 0;
outline: @focusOutline;
}

.ui.slider .inner {
Expand Down
2 changes: 2 additions & 0 deletions src/themes/default/collections/form.variables
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@
@inputFocusColor: @selectedTextColor;
@inputFocusBoxShadow: @inputFocusPointerSize 0 0 0 @selectedBorderColor inset;
@inputFocusBorderRadius: @inputBorderRadius;
@inputFocusOutline: @focusOutline;

/* Text Area Focus */
@textAreaFocusBackground: @inputFocusBackground;
@textAreaFocusBorderColor: @inputFocusBorderColor;
@textAreaFocusColor: @inputFocusColor;
@textAreaFocusBoxShadow: @inputFocusBoxShadow;
@textAreaFocusBorderRadius: @inputFocusBorderRadius;
@textAreaFocusOutline: @focusOutline;

/* Disabled */
@disabledLabelOpacity: @disabledOpacity;
Expand Down
1 change: 1 addition & 0 deletions src/themes/default/globals/site.variables
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,7 @@
/* -------------------
Focus
-------------------- */
@focusOutline: none;

/* --- Colors --- */
@primaryColorFocus: if(iscolor(@primaryColor), saturate(darken(@primaryColor, 8), 20, relative), @primaryColor);
Expand Down
2 changes: 2 additions & 0 deletions src/themes/default/modules/checkbox.variables
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
@checkboxFocusBorderColor: @focusedFormMutedBorderColor;
@checkboxFocusCheckColor: @selectedTextColor;
@labelFocusColor: @selectedTextColor;
@labelFocusOutline: @focusOutline;
@inputFocusOutline: @focusOutline;

/* Active */
@labelActiveColor: @selectedTextColor;
Expand Down
4 changes: 4 additions & 0 deletions src/themes/default/modules/dropdown.variables
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
@menuPadding: 0;
@menuTop: 100%;
@menuTextAlign: left;
@menuFocusOutline: @focusOutline;

@menuBorderWidth: 1px;
@menuBorderColor: @borderColor;
Expand Down Expand Up @@ -202,6 +203,8 @@
@selectionFocusBorderColor: @focusedFormMutedBorderColor;
@selectionFocusBoxShadow: none;
@selectionFocusMenuBoxShadow: @raisedShadow;
@selectionFocusOutline: @focusOutline;
@selectionMenuFocusOutline: @focusOutline;

/* Visible */
@selectionVisibleTextFontWeight: @normal;
Expand All @@ -224,6 +227,7 @@
-------------- */

@searchMinWidth: "";
@searchFocusOutline: @focusOutline;

/* Search Selection */
@searchSelectionLineHeight: @inputLineHeight;
Expand Down
3 changes: 3 additions & 0 deletions src/themes/default/modules/flyout.variables
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
@duration: 500ms;
@easing: @defaultEasing;

/* Focus */
@closeFocusOutline: @focusOutline;

/* Dimmer */
@dimmerColor: rgba(0, 0, 0, 0.4);
@dimmerTransition: all @duration;
Expand Down
1 change: 1 addition & 0 deletions src/themes/default/modules/modal.variables
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@closeOpacityDimmed: 0.1;
@closeSize: 1.25em;
@closeColor: @white;
@closeFocusOutline: @focusOutline;

@closeHitbox: 2.25rem;
@closeDistance: 0.25rem;
Expand Down