Skip to content

Commit e812d65

Browse files
authored
[A11y] Increase touch target of list items nested in tables (#1174)
* Add bottom margin * Add story with list in table
1 parent 6c45a70 commit e812d65

File tree

2 files changed

+123
-1
lines changed

2 files changed

+123
-1
lines changed

packages/components/src/templates/next/components/native/Table/Table.stories.tsx

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,3 +2025,125 @@ export const NestedColumns: Story = {
20252025
],
20262026
},
20272027
}
2028+
2029+
export const ListInTable: Story = {
2030+
args: {
2031+
attrs: {
2032+
caption: "Resources for the scheme",
2033+
},
2034+
content: [
2035+
{
2036+
type: "tableRow",
2037+
content: [
2038+
{
2039+
type: "tableHeader",
2040+
content: [
2041+
{
2042+
type: "paragraph",
2043+
content: [{ type: "text", text: "Category" }],
2044+
},
2045+
],
2046+
},
2047+
{
2048+
type: "tableHeader",
2049+
content: [
2050+
{
2051+
type: "paragraph",
2052+
content: [{ type: "text", text: "Files for download" }],
2053+
},
2054+
],
2055+
},
2056+
],
2057+
},
2058+
{
2059+
type: "tableRow",
2060+
content: [
2061+
{
2062+
type: "tableCell",
2063+
content: [
2064+
{
2065+
type: "paragraph",
2066+
content: [{ type: "text", text: "Files for everyone" }],
2067+
},
2068+
],
2069+
},
2070+
{
2071+
type: "tableCell",
2072+
content: [
2073+
{
2074+
type: "paragraph",
2075+
content: [
2076+
{
2077+
type: "text",
2078+
text: "Here are some files you can download:",
2079+
},
2080+
],
2081+
},
2082+
{
2083+
type: "unorderedList",
2084+
content: [
2085+
{
2086+
type: "listItem",
2087+
content: [
2088+
{
2089+
type: "paragraph",
2090+
content: [
2091+
{
2092+
type: "text",
2093+
text: "<a href='https://google.com'>A long file name that's available for download [PDF, 2MB]</a>",
2094+
},
2095+
],
2096+
},
2097+
],
2098+
},
2099+
{
2100+
type: "listItem",
2101+
content: [
2102+
{
2103+
type: "paragraph",
2104+
content: [
2105+
{
2106+
type: "text",
2107+
text: "<a href='https://google.com'>An even longer file name that's available for download [PDF, 2MB]</a>",
2108+
},
2109+
],
2110+
},
2111+
],
2112+
},
2113+
{
2114+
type: "listItem",
2115+
content: [
2116+
{
2117+
type: "paragraph",
2118+
content: [
2119+
{
2120+
type: "text",
2121+
text: "<a href='https://google.com'>A long file name that's available for download [PDF, 2MB]</a>",
2122+
},
2123+
],
2124+
},
2125+
],
2126+
},
2127+
{
2128+
type: "listItem",
2129+
content: [
2130+
{
2131+
type: "paragraph",
2132+
content: [
2133+
{
2134+
type: "text",
2135+
text: "<a href='https://google.com'>A very very very long file name that's available for download [PDF, 2MB]</a>",
2136+
},
2137+
],
2138+
},
2139+
],
2140+
},
2141+
],
2142+
},
2143+
],
2144+
},
2145+
],
2146+
},
2147+
],
2148+
},
2149+
}

packages/components/src/templates/next/components/native/Table/Table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Paragraph from "../Paragraph"
99
import UnorderedList from "../UnorderedList"
1010

1111
const tableCellStyles = tv({
12-
base: "max-w-40 break-words border border-base-divider-medium px-4 py-3 align-top [&_li]:my-0 [&_li]:pl-1 [&_ol]:mt-0 [&_ol]:ps-5 [&_ul]:mt-0 [&_ul]:ps-5",
12+
base: "max-w-40 break-words border border-base-divider-medium px-4 py-3 align-top [&_li]:mb-4 [&_li]:mt-0 [&_li]:pl-1 [&_ol]:mt-0 [&_ol]:ps-5 [&_ul]:mt-0 [&_ul]:ps-5",
1313
variants: {
1414
isHeader: {
1515
true: "bg-base-canvas-backdrop [&_ol]:prose-label-md-medium [&_p]:prose-label-md-medium",

0 commit comments

Comments
 (0)