diff --git a/website/src/components/APITable/index.tsx b/website/src/components/APITable/index.tsx index db94ae6fb649..91ef2d509caa 100644 --- a/website/src/components/APITable/index.tsx +++ b/website/src/components/APITable/index.tsx @@ -58,9 +58,12 @@ function APITableRow( tabIndex={0} ref={history.location.hash === anchor ? ref : undefined} onClick={(e) => { - const isLinkClick = - (e.target as HTMLElement).tagName.toUpperCase() === 'A'; - if (!isLinkClick) { + const isTDClick = + (e.target as HTMLElement).tagName.toUpperCase() === 'TD'; + const hasSelectedText = !!window.getSelection()?.toString(); + + const shouldNavigate = isTDClick && !hasSelectedText; + if (shouldNavigate) { history.push(anchor); } }} diff --git a/website/src/components/APITable/styles.module.css b/website/src/components/APITable/styles.module.css index 4048c94243d2..e22474dacef2 100644 --- a/website/src/components/APITable/styles.module.css +++ b/website/src/components/APITable/styles.module.css @@ -20,3 +20,7 @@ cursor: pointer; transition: box-shadow 0.2s; } + +.apiTable code { + cursor: text; +}