|
1 | 1 | 'use client' |
2 | 2 |
|
3 | | -import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react' |
| 3 | +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' |
4 | 4 | import { useParams, useRouter } from 'next/navigation' |
5 | 5 | import { usePostHog } from 'posthog-js/react' |
6 | 6 | import { |
@@ -2905,7 +2905,7 @@ const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({ |
2905 | 2905 | }) { |
2906 | 2906 | const renameInputRef = useRef<HTMLInputElement>(null) |
2907 | 2907 |
|
2908 | | - useLayoutEffect(() => { |
| 2908 | + useEffect(() => { |
2909 | 2909 | if (isRenaming && renameInputRef.current) { |
2910 | 2910 | renameInputRef.current.focus() |
2911 | 2911 | renameInputRef.current.select() |
@@ -2958,6 +2958,7 @@ const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({ |
2958 | 2958 | const handleThPointerDown = useCallback( |
2959 | 2959 | (e: React.PointerEvent) => { |
2960 | 2960 | if (isRenaming || e.button !== 0) return |
| 2961 | + if ((e.target as HTMLElement).closest('button')) return |
2961 | 2962 | e.preventDefault() |
2962 | 2963 |
|
2963 | 2964 | const th = e.currentTarget as HTMLElement |
@@ -3041,36 +3042,27 @@ const ColumnHeaderMenu = React.memo(function ColumnHeaderMenu({ |
3041 | 3042 | )} |
3042 | 3043 | </div> |
3043 | 3044 | ) : ( |
3044 | | - <div className='flex h-full w-full min-w-0 items-center px-2 py-[7px]'> |
3045 | | - <ColumnTypeIcon type={column.type} /> |
3046 | | - <span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap font-medium text-[var(--text-primary)] text-small'> |
3047 | | - {column.name} |
3048 | | - </span> |
3049 | | - {sortDirection && ( |
3050 | | - <span className='ml-1 shrink-0'> |
3051 | | - <SortDirectionIndicator direction={sortDirection} /> |
3052 | | - </span> |
3053 | | - )} |
3054 | | - <button |
3055 | | - type='button' |
3056 | | - onPointerDown={(e) => e.stopPropagation()} |
3057 | | - onClick={() => { |
3058 | | - onColumnSelect?.(colIndex, false) |
3059 | | - setMenuOpen((o) => !o) |
3060 | | - }} |
3061 | | - className='ml-1 flex shrink-0 cursor-pointer items-center opacity-0 outline-none transition-opacity group-hover:opacity-100' |
3062 | | - > |
3063 | | - <ChevronDown className='h-[7px] w-[9px] text-[var(--text-muted)]' /> |
3064 | | - </button> |
| 3045 | + <div className='flex h-full w-full min-w-0 items-center'> |
3065 | 3046 | <DropdownMenu open={menuOpen} onOpenChange={setMenuOpen}> |
3066 | 3047 | <DropdownMenuTrigger asChild> |
3067 | | - <div className='pointer-events-none absolute inset-0' /> |
| 3048 | + <button |
| 3049 | + type='button' |
| 3050 | + onClick={(e) => onColumnSelect?.(colIndex, e.shiftKey)} |
| 3051 | + className='flex min-w-0 flex-1 cursor-pointer items-center px-2 py-[7px] outline-none' |
| 3052 | + > |
| 3053 | + <ColumnTypeIcon type={column.type} /> |
| 3054 | + <span className='ml-1.5 min-w-0 overflow-clip text-ellipsis whitespace-nowrap font-medium text-[var(--text-primary)] text-small'> |
| 3055 | + {column.name} |
| 3056 | + </span> |
| 3057 | + {sortDirection && ( |
| 3058 | + <span className='ml-1 shrink-0'> |
| 3059 | + <SortDirectionIndicator direction={sortDirection} /> |
| 3060 | + </span> |
| 3061 | + )} |
| 3062 | + <ChevronDown className='ml-1 h-[7px] w-[9px] shrink-0 text-[var(--text-muted)] opacity-0 transition-opacity group-hover:opacity-100' /> |
| 3063 | + </button> |
3068 | 3064 | </DropdownMenuTrigger> |
3069 | | - <DropdownMenuContent |
3070 | | - align='start' |
3071 | | - sideOffset={0} |
3072 | | - onCloseAutoFocus={(e) => e.preventDefault()} |
3073 | | - > |
| 3065 | + <DropdownMenuContent align='start' sideOffset={0}> |
3074 | 3066 | <DropdownMenuItem onSelect={() => onSortAsc?.(column.name)}> |
3075 | 3067 | <ArrowUp /> |
3076 | 3068 | Sort ascending |
|
0 commit comments