Skip to content

Commit 994813d

Browse files
authored
feat: Switch to 1px outline for all inputs and buttons, as well as use background color in lists (#4276)
## Description Most controls are affected 2px > 1px Navigator and project settings lists now use background color instead of outline ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent fc14133 commit 994813d

File tree

27 files changed

+50
-85
lines changed

27 files changed

+50
-85
lines changed

apps/builder/app/auth/brand-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const buttonStyle = css({
2626
boxShadow: theme.shadows.brandElevationBig,
2727
},
2828
"&:focus-visible": {
29-
outline: `2px solid ${theme.colors.borderFocus}`,
29+
outline: `1px solid ${theme.colors.borderFocus}`,
3030
outlineOffset: 1,
3131
},
3232
"&:disabled": {

apps/builder/app/builder/features/project-settings/project-settings.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
Flex,
1010
List,
1111
ListItem,
12-
focusRingStyle,
1312
Text,
1413
} from "@webstudio-is/design-system";
1514
import { $isProjectSettingsOpen } from "~/shared/nano-states/seo";
@@ -19,8 +18,6 @@ import { useState } from "react";
1918
import { SectionMarketplace } from "./section-marketplace";
2019
import { leftPanelWidth, rightPanelWidth } from "./utils";
2120

22-
const focusOutline = focusRingStyle();
23-
2421
const sectionNames = ["General", "Redirects", "Marketplace"];
2522

2623
type SectionName = (typeof sectionNames)[number];
@@ -72,8 +69,9 @@ export const ProjectSettingsView = ({
7269
height: theme.spacing[13],
7370
px: theme.spacing[9],
7471
outline: "none",
75-
"&:focus-visible": focusOutline,
76-
"&:hover": focusOutline,
72+
"&:focus-visible, &:hover": {
73+
background: theme.colors.backgroundHover,
74+
},
7775
"&[aria-current=true]": {
7876
background: theme.colors.backgroundItemCurrent,
7977
color: theme.colors.foregroundMain,

apps/builder/app/builder/features/sidebar-left/sidebar-tabs.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
TabsTrigger,
77
Tooltip,
88
css,
9+
focusRingStyle,
910
styled,
1011
theme,
1112
} from "@webstudio-is/design-system";
@@ -19,17 +20,7 @@ export const SidebarTabs = styled(Tabs, {
1920
boxSizing: "border-box",
2021
});
2122

22-
const triggerFocusRing = {
23-
"&::after": {
24-
content: '""',
25-
position: "absolute",
26-
inset: 4,
27-
outlineWidth: 2,
28-
outlineStyle: "solid",
29-
outlineColor: theme.colors.borderFocus,
30-
borderRadius: theme.borderRadius[3],
31-
},
32-
};
23+
const triggerFocusRing = focusRingStyle();
3324

3425
const buttonStyle = css({
3526
position: "relative",

apps/builder/app/builder/features/style-panel/sections/layout/shared/flex-grid.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,16 @@ export const FlexGrid = () => {
7676
height: 72,
7777
padding: theme.spacing[4],
7878
borderRadius: theme.borderRadius[4],
79+
outline: "none",
80+
border: `1px solid ${color}`,
7981
background: theme.colors.backgroundControls,
8082
alignItems: "center",
8183
gap: 0,
8284
gridTemplateColumns: "repeat(3, 1fr)",
8385
gridTemplateRows: "repeat(3, 1fr)",
8486
color,
85-
outlineStyle: "solid",
86-
outlineWidth: styleValueSourceColor === "default" ? 1 : 2,
87-
outlineOffset: styleValueSourceColor === "default" ? -1 : -2,
88-
outlineColor: color,
8987
"&:focus-within": {
90-
outlineWidth: 2,
91-
outlineOffset: -2,
92-
outlineColor: theme.colors.borderLocalFlexUi,
88+
borderColor: theme.colors.borderLocalFlexUi,
9389
},
9490
}}
9591
>

apps/builder/app/builder/features/style-panel/sections/position/inset-control.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ export const InsetControl = () => {
127127
height: theme.spacing[18],
128128
"&:focus-visible": {
129129
borderRadius: theme.borderRadius[3],
130-
outline: `2px solid ${theme.colors.blue10}`,
130+
outline: `1px solid ${theme.colors.blue10}`,
131+
outlineOffset: -1,
131132
},
132133
}}
133134
onFocus={keyboardNavigation.handleFocus}

apps/builder/app/builder/features/style-panel/sections/space/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ const Container = styled("div", {
150150
// (both in z-order and in top/left)
151151
[`&:focus-visible > ${Grid}`]: {
152152
borderRadius: theme.borderRadius[3],
153-
outline: `2px solid ${theme.colors.blue10}`,
153+
outline: `1px solid ${theme.colors.borderFocus}`,
154154
},
155155
});
156156

apps/builder/app/builder/features/style-panel/shared/color-thumb.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ const thumbStyle = css({
5959
borderRadius: theme.borderRadius[2],
6060
borderWidth: 0,
6161
borderStyle: "solid",
62+
"&:focus-visible": {
63+
outline: `1px solid ${theme.colors.borderFocus}`,
64+
outlineOffset: 1,
65+
},
6266
});
6367

6468
type Props = Omit<ComponentProps<"button">, "color"> & {

apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ const TextFieldContainer = styled("div", {
8686
minWidth: 0,
8787
border: `1px solid ${theme.colors.borderMain}`,
8888
"&:focus-within": {
89-
outline: `2px solid ${theme.colors.borderFocus}`,
90-
outlineOffset: -1,
89+
borderColor: theme.colors.borderFocus,
9190
},
9291
});
9392

@@ -173,16 +172,12 @@ const TextFieldBase: ForwardRefRenderFunction<
173172
{...textFieldProps}
174173
variant="chromeless"
175174
css={{
176-
color: theme.colors.hiContrast,
177175
fontVariantNumeric: "tabular-nums",
178-
fontFamily: theme.fonts.sans,
179-
fontSize: theme.deprecatedFontSize[3],
180176
lineHeight: 1,
181177
order: 1,
182-
border: "none",
183178
flex: 1,
184179
"&:focus-within, &:hover": {
185-
outline: "none",
180+
borderColor: "transparent",
186181
},
187182
}}
188183
size="1"

apps/builder/app/builder/shared/code-editor-base.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ const editorContentStyle = css({
8585
userSelect: "text",
8686
"&:focus-within": {
8787
borderColor: theme.colors.borderFocus,
88-
outline: `1px solid ${theme.colors.borderFocus}`,
8988
},
9089
'&[data-invalid="true"]': {
9190
borderColor: theme.colors.borderDestructiveMain,

apps/builder/app/builder/shared/image-manager/image-thumbnail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const ThumbnailContainer = styled(Box, {
5656
},
5757
state: {
5858
selected: {
59-
boxShadow: `0px 0px 0px 2px ${theme.colors.blue10}, 0px 0px 0px 2px ${theme.colors.blue10}`,
59+
outline: `1px solid ${theme.colors.borderFocus}`,
6060
},
6161
},
6262
},

0 commit comments

Comments
 (0)