Skip to content

Commit 086b125

Browse files
committed
ref #367, browser compat tables WIP
1 parent 0e3ceab commit 086b125

File tree

14 files changed

+205
-27
lines changed

14 files changed

+205
-27
lines changed

Diff for: client/src/app.scss

+5-2
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ main {
6161
min-height: 80vh;
6262
}
6363

64-
// !!! This is not an accessible way to hide content
6564
.visually-hidden {
66-
display: none;
65+
font: 0/0 a;
66+
padding: 0 !important;
67+
margin: 0 !important;
68+
height: 0;
69+
color: transparent;
6770
}
6871

6972
pre {

Diff for: client/src/assets/icons/desktop.svg

+8
Loading

Diff for: client/src/assets/icons/disabled.svg

+3
Loading

Diff for: client/src/assets/icons/footnote.svg

+1
Loading

Diff for: client/src/assets/icons/mobile.svg

+3
Loading

Diff for: client/src/assets/icons/no.svg

+3
Loading

Diff for: client/src/assets/icons/preview.svg

+2
Loading

Diff for: client/src/assets/icons/server.svg

+8
Loading

Diff for: client/src/assets/icons/yes-circle.svg

+1
Loading

Diff for: client/src/assets/icons/yes.svg

+3
Loading

Diff for: client/src/document/ingredients/browser-compatibility-table/feature-row.tsx

+23-18
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function StatusIcons({ status }: { status: bcd.StatusBlock }) {
8888
},
8989
].filter(isTruthy);
9090
return icons.length === 0 ? null : (
91-
<div className="bc-icons">
91+
<div className="bc-icons" data-test={icons.length}>
9292
{icons.map((icon) => (
9393
<abbr key={icon.iconClassName} className="only-icon" title={icon.title}>
9494
<span>{icon.text}</span>
@@ -206,15 +206,21 @@ const CellText = React.memo(
206206

207207
return (
208208
<>
209-
<abbr
210-
className={`bc-level-${getSupportClassName(
211-
currentSupport
212-
)} only-icon`}
213-
title={title}
214-
>
215-
<span>{title}</span>
216-
</abbr>
217-
<span>{label}</span>
209+
<span className="icon-wrap">
210+
<abbr
211+
className={`
212+
bc-level-${getSupportClassName(currentSupport)}
213+
icon
214+
icon-${getSupportClassName(currentSupport)}`}
215+
title={title}
216+
>
217+
<span className="bc-support-level">{title}</span>
218+
</abbr>
219+
<span className="bc-version-label">
220+
{" "}
221+
{browser} {label}
222+
</span>
223+
</span>
218224
</>
219225
);
220226
}
@@ -224,7 +230,7 @@ function Icon({ name }: { name: string }) {
224230
return (
225231
<abbr className="only-icon" title={name}>
226232
<span>{name}</span>
227-
<i className={`ic-${name}`} />
233+
<i className={`icon icon-${name}`} />
228234
</abbr>
229235
);
230236
}
@@ -239,7 +245,6 @@ function CellIcons({ support }: { support: bcd.SupportStatement | undefined }) {
239245
{supportItem.prefix && <Icon name="prefix" />}
240246
{supportItem.alternative_name && <Icon name="altname" />}
241247
{supportItem.flags && <Icon name="disabled" />}
242-
{supportItem.notes && <Icon name="footnote" />}
243248
</div>
244249
);
245250
}
@@ -305,7 +310,7 @@ function getNotes(
305310
const supportNotes = [
306311
item.version_removed
307312
? {
308-
iconName: "footnote",
313+
iconName: "disabled",
309314
label: (
310315
<>
311316
Removed in {labelFromString(item.version_removed, browser)}{" "}
@@ -334,7 +339,7 @@ function getNotes(
334339
: null,
335340
item.flags
336341
? {
337-
iconName: "footnote",
342+
iconName: "disabled",
338343
label: <FlagsNote browser={browser} supportItem={item} />,
339344
}
340345
: null,
@@ -374,7 +379,7 @@ function getNotes(
374379
)} bc-supports`}
375380
>
376381
<CellText support={item} browser={browser} />
377-
<CellIcons support={item} />
382+
{/**<CellIcons support={item} /> */}
378383
</dt>
379384
{supportNotes.map(({ iconName, label }, i) => {
380385
return (
@@ -425,7 +430,7 @@ function CompatCell({
425430
return (
426431
<>
427432
<td
428-
className={`bc-browser-${browser} bc-supports-${supportClassName} ${
433+
className={`bc-icon-cell bc-browser-${browser} bc-supports-${supportClassName} ${
429434
hasNotes ? "bc-has-history" : ""
430435
}`}
431436
aria-expanded={showNotes ? "true" : "false"}
@@ -441,7 +446,7 @@ function CompatCell({
441446
browserReleaseDate ? `Released ${browserReleaseDate}` : undefined
442447
}
443448
>
444-
<span className="bc-browser-name">
449+
<span className="bc-browser-name visually-hidden">
445450
<BrowserName id={browser} />
446451
</span>
447452
<CellText {...{ support }} browser={browser} />
@@ -450,7 +455,7 @@ function CompatCell({
450455
<button
451456
type="button"
452457
title="Open implementation notes"
453-
className={`bc-history-link only-icon ${
458+
className={`bc-history-link ${
454459
showNotes ? "bc-history-link-inverse" : ""
455460
}`}
456461
>

Diff for: client/src/document/ingredients/browser-compatibility-table/headers.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ function PlatformHeaders({ platforms, browsers }) {
3434
className={`bc-platform-${platformId}`}
3535
colSpan={browserCount}
3636
>
37-
<span>{platform}</span>
37+
<span className={`icon icon-${platformId}`}></span>
38+
<span className="visually-hidden">{platform}</span>
3839
</th>
3940
);
4041
})}

Diff for: client/src/document/ingredients/browser-compatibility-table/index.scss

+135-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,116 @@
11
@use "~@mdn/minimalist/sass/mixins/utils" as *;
2+
@use "../../../ui/vars" as *;
3+
4+
.bc {
5+
&-table {
6+
border: 1px solid var(--border-primary);
7+
border-collapse: collapse;
8+
width: 100%;
9+
10+
td,
11+
th {
12+
border: 1px solid var(--border-primary);
13+
font: var(--type-body-m);
14+
padding: 0.5rem;
15+
}
16+
17+
th {
18+
vertical-align: bottom;
19+
text-align: center;
20+
}
21+
22+
tbody th {
23+
min-width: 20%;
24+
}
25+
}
26+
27+
&-head-txt-label {
28+
-ms-writing-mode: tb-rl;
29+
-webkit-writing-mode: vertical-rl;
30+
writing-mode: vertical-rl;
31+
transform: rotate(180deg);
32+
white-space: nowrap;
33+
}
34+
35+
&-icon-cell {
36+
text-align: center;
37+
vertical-align: middle;
38+
39+
.bc-version-label,
40+
.bc-support-level {
41+
display: none;
42+
}
43+
}
44+
45+
&-history-link {
46+
@include visually-hidden;
47+
position: absolute; // messing up layout otherwise
48+
}
49+
50+
&-level-no {
51+
background-color: var(--icon-critical);
52+
}
53+
54+
&-level-preview {
55+
background-color: var(--icon-information);
56+
}
57+
}
58+
59+
.bc-platforms {
60+
th {
61+
text-align: center;
62+
}
63+
}
64+
65+
.bc-notes-list {
66+
margin-left: 20%;
67+
position: relative;
68+
69+
&:before {
70+
position: absolute;
71+
z-index: -1;
72+
height: 100%;
73+
left: 7px;
74+
width: 2px;
75+
background: var(--border-primary);
76+
content: "";
77+
}
78+
79+
.bc-level-yes.icon.icon-yes {
80+
// override icon
81+
background-color: var(--icon-success);
82+
mask-image: url("../../../assets/icons/yes-circle.svg");
83+
}
84+
85+
.icon.icon-footnote {
86+
mask-image: none;
87+
border-radius: 50%;
88+
border: 3px solid var(--background-primary);
89+
background: var(--border-primary);
90+
}
91+
92+
.icon.icon-disabled {
93+
background-color: var(--icon-information);
94+
}
95+
96+
.bc-support-level {
97+
display: none;
98+
}
99+
100+
.icon-wrap {
101+
background: var(--background-primary);
102+
}
103+
104+
abbr {
105+
margin-right: 4px;
106+
}
107+
108+
dd {
109+
margin-bottom: 1rem;
110+
padding-left: 1.5rem;
111+
text-indent: -1.5rem;
112+
}
113+
}
2114

3115
.offscreen,
4116
.only-icon span {
@@ -17,7 +129,7 @@
17129
overflow: hidden;
18130
}
19131

20-
/* Can only flex-shrink and not flex-grow
132+
/* Can only flex-shrink and not flex-grow
21133
ie the "slider" in a sliding glass door */
22134
.left-side {
23135
flex: 0 1 auto;
@@ -29,3 +141,25 @@
29141
flex: 1 0 auto;
30142
}
31143
}
144+
145+
@media screen and (min-width: $screen-md) {
146+
.bc-icon-cell {
147+
&[aria-expanded="true"] {
148+
position: relative;
149+
150+
&:after {
151+
position: absolute;
152+
left: 0;
153+
bottom: -1px;
154+
height: 2px;
155+
width: 100%;
156+
background: #fff;
157+
content: "";
158+
}
159+
160+
.bc-history-mobile {
161+
display: none;
162+
}
163+
}
164+
}
165+
}

Diff for: client/src/ui/atoms/icon/index.scss

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
$icons: "add-filled", "add", "bell-filled", "bell", "bookmark-filled",
2-
"bookmark", "cancel", "checkmark", "chevron", "critical", "edit", "ellipses",
3-
"external", "eye-filled", "eye", "firefox", "github-mark-small", "information",
4-
"language", "menu-filled", "menu", "search", "sidebar", "small-arrow",
5-
"star-filled", "star", "theme", "trash", "twitter", "warning";
2+
"bookmark", "cancel", "checkmark", "chevron", "critical", "desktop",
3+
"disabled", "edit", "ellipses", "external", "eye-filled", "eye", "firefox",
4+
"footnote", "github-mark-small", "information", "language", "menu-filled",
5+
"menu", "mobile", "no", "preview", "search", "server", "sidebar",
6+
"small-arrow", "star-filled", "star", "theme", "trash", "twitter", "warning",
7+
"yes", "yes-circle";
68

79
.icon {
810
--size: var(--icon-size, 1rem);
9-
1011
background-color: var(--icon-primary);
1112
display: inline-block;
1213
height: var(--size);
1314
width: var(--size);
1415
vertical-align: middle;
16+
mask-position: center;
17+
mask-repeat: no-repeat;
1518
}
1619

1720
.icon {

0 commit comments

Comments
 (0)