diff --git a/packages/vant/src/cell/Cell.tsx b/packages/vant/src/cell/Cell.tsx index bcb8d3802b2..5bebb513f03 100644 --- a/packages/vant/src/cell/Cell.tsx +++ b/packages/vant/src/cell/Cell.tsx @@ -146,7 +146,11 @@ export default defineComponent({ return () => { const { tag, size, center, border, isLink, required } = props; - const clickable = props.clickable ?? isLink; + // `to` / `url` props imply clickable behavior (same as before v4.10.0), + // so Cells with a route target keep working without an explicit `clickable` prop. + const clickable = Boolean( + props.clickable ?? props.to ?? props.url ?? isLink, + ); const classes: Record = { center, diff --git a/packages/vant/src/cell/test/index.spec.ts b/packages/vant/src/cell/test/index.spec.ts index e9a9809df77..4719d05a817 100644 --- a/packages/vant/src/cell/test/index.spec.ts +++ b/packages/vant/src/cell/test/index.spec.ts @@ -107,6 +107,27 @@ test('should not render as button when clickable is false with is-link prop', () expect(root.attributes('tabindex')).toBeFalsy(); }); +test('should be clickable when only to prop is set (regression #13868)', () => { + const wrapper = mount(Cell, { + props: { + to: '/foo', + }, + }); + expect(wrapper.classes()).toContain('van-cell--clickable'); + const root = wrapper.find('.van-cell'); + expect(root.attributes('role')).toEqual('button'); + expect(root.attributes('tabindex')).toEqual('0'); +}); + +test('should be clickable when only url prop is set (regression #13868)', () => { + const wrapper = mount(Cell, { + props: { + url: 'https://example.com', + }, + }); + expect(wrapper.classes()).toContain('van-cell--clickable'); +}); + test('should render tag prop correctly', () => { const wrapper = mount(Cell, { props: {