Skip to content

Commit

Permalink
188104017 v3 Input Row Tab (#1403)
Browse files Browse the repository at this point in the history
* Remove blur handlers.
  • Loading branch information
tealefristoe authored Aug 15, 2024
1 parent fcd56d0 commit e52669a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
8 changes: 2 additions & 6 deletions v3/src/components/case-table/cell-text-editor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ describe("CellTextEditor", () => {
expect(editor).toHaveClass("rdg-text-editor")
await user.keyboard("1")
fireEvent.blur(editor)
// fails for some reason even though the function is clearly called
// expect(onRowChange).toHaveBeenCalled()
expect(onClose).toHaveBeenCalled()
expect(onRowChange).toHaveBeenCalled()
})

it("should render with dataset", async () => {
Expand All @@ -42,8 +40,6 @@ describe("CellTextEditor", () => {
expect(editor).toHaveClass("rdg-text-editor")
await user.keyboard("1")
fireEvent.blur(editor)
// fails for some reason even though the function is clearly called
// expect(onRowChange).toHaveBeenCalled()
expect(onClose).toHaveBeenCalled()
expect(onRowChange).toHaveBeenCalled()
})
})
1 change: 0 additions & 1 deletion v3/src/components/case-table/cell-text-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export default function CellTextEditor({ row, column, onRowChange, onClose }: TR
ref={autoFocusAndSelect}
value={valueRef.current}
onChange={(event) => handleChange(event.target.value)}
onBlur={() => onClose(true)}
/>
)
}
11 changes: 0 additions & 11 deletions v3/src/components/case-table/color-cell-text-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ export default function ColorCellTextEditor({ row, column, onRowChange, onClose

const { isOpen: isPaletteOpen, onToggle: togglePalette } = useDisclosure()

function handleSwatchPointerDown(event: React.PointerEvent) {
// prevent blurring the input
event.preventDefault()
}

function handleSwatchClick(event: React.MouseEvent) {
togglePalette()
}
Expand All @@ -91,15 +86,10 @@ export default function ColorCellTextEditor({ row, column, onRowChange, onClose
updateValue(event.target.value)
}

function handleInputBlur() {
!isPaletteOpen && acceptValue()
}

const swatchStyle: React.CSSProperties | undefined = showColorSwatch.current ? { background: color } : undefined
const inputElt = <InputElt
value={inputValue}
onChange={handleInputColorChange}
onBlur={handleInputBlur}
/>

return swatchStyle
Expand All @@ -113,7 +103,6 @@ export default function ColorCellTextEditor({ row, column, onRowChange, onClose
>
<PopoverTrigger>
<button className="cell-edit-color-swatch"
onPointerDown={handleSwatchPointerDown}
onClick={handleSwatchClick}>
<div className="cell-edit-color-swatch-interior" style={swatchStyle}/>
</button>
Expand Down

0 comments on commit e52669a

Please sign in to comment.