Repository: Shopify/polaris-react (TypeScript)

Issue:
onClick Disabled on IndexTable.Row when IndexTable prop 'selectable' is set to false
## Issue summary

Setting the `IndexTable` prop of selectable to `false` causes the onClick callback of `IndexTable.Row` to not fire. 

## Expected behavior

I would assume that you would still be able to have an onClick event on the row even if the checkboxes are disabled/hidden. I'm on the fence as to whether this is intentional or not as the cursor is set to default in this state.

In the below example I would expect handleClick() to still fire.

```jsx
<IndexTable selectable={false}>
  <IndexTable.Row onClick={() => handleClick()}>
        {/* row content */}
  </IndexTable.Row>
</IndexTable>
```



Discussion:

Patch:
diff --git a/.changeset/odd-swans-teach.md b/.changeset/odd-swans-teach.md
new file mode 100644
index 00000000000..666cd9e2514
--- /dev/null
+++ b/.changeset/odd-swans-teach.md
@@ -0,0 +1,5 @@
+--- 
+'@shopify/polaris': patch
+---
+
+Fixed `IndexTable.Row` `onClick` not being called when `selectable` is `false`
diff --git a/polaris-react/src/components/IndexTable/components/Row/Row.tsx b/polaris-react/src/components/IndexTable/components/Row/Row.tsx
index d35dd3ec7e4..6a14e5bad39 100644
--- a/polaris-react/src/components/IndexTable/components/Row/Row.tsx
+++ b/polaris-react/src/components/IndexTable/components/Row/Row.tsx
@@ -120,13 +120,14 @@ export const Row = memo(function Row({
     disabled && styles['TableRow-disabled'],
     tone && styles[variationName('tone', tone)],
     !selectable &&
+      !onClick &&
       !primaryLinkElement.current &&
       styles['TableRow-unclickable'],
   );
 
   let handleRowClick;
 
-  if ((!disabled && selectable) || primaryLinkElement.current) {
+  if ((!disabled && selectable) || onClick || primaryLinkElement.current) {
     handleRowClick = (event: React.MouseEvent) => {
       if (rowType === 'subheader') return;
 
@@ -141,7 +142,7 @@ export const Row = memo(function Row({
         return;
       }
 
-      if (primaryLinkElement.current && !selectMode) {
+      if (primaryLinkElement.current && !selectMode && selectable) {
         isNavigating.current = true;
         const {ctrlKey, metaKey} = event.nativeEvent;
 


Test patch:
diff --git a/polaris-react/src/components/IndexTable/components/Row/tests/Row.test.tsx b/polaris-react/src/components/IndexTable/components/Row/tests/Row.test.tsx
index 01bae16bfa6..6f20af50f2a 100644
--- a/polaris-react/src/components/IndexTable/components/Row/tests/Row.test.tsx
+++ b/polaris-react/src/components/IndexTable/components/Row/tests/Row.test.tsx
@@ -444,6 +444,27 @@ describe('<Row />', () => {
     );
   });
 
+  it('fires onClick handler when row has an onclick and is clicked despite no primary link child present and the table not being selectable', () => {
+    const mockOnClick = jest.fn();
+    const row = mountWithTable(
+      <Row {...defaultProps} onClick={mockOnClick}>
+        <th>
+          <a href="/">Child without data-primary-link</a>
+        </th>
+      </Row>,
+      {
+        indexTableProps: {
+          itemCount: 1,
+          selectable: false,
+        },
+      },
+    );
+
+    triggerOnClick(row, 1, defaultEvent);
+
+    expect(mockOnClick).toHaveBeenCalled();
+  });
+
   it('has an undefined tone by default', () => {
     const row = mountWithTable(
       <Row {...defaultProps}>