Issue 2, Calendar Overlay Cannot Select the Day Label Issue
Issue: When editingMeta is updated, the cell gains focus. Consequently, selecting a date in the calendar overlay updates the editingMeta value, causing the cell to regain focus repeatedly. As a result, even after selecting a date, the selected value remains null.
Cause: The update to editingMeta triggers the cell to regain focus, which interferes with the date selection process in the calendar overlay.
Solution: To address this, focusOnElement() and updateStickyPosition() are only invoked when editMode, editing, or editingState are updated.
React.useEffect(() => {
if (getColumnProp('frozen')) {
updateStickyPosition();
}
if (props.editMode === 'cell' || props.editMode === 'row') {
focusOnElement();
}
}, [props.editMode, props.editing, editingState]); // Updated to include dependencies
Issue 3, Focus Remains When Clicking Outside of the Cell
Issue: When clicking outside of the cell (Calendar), the cell remains focused.
Cause: The focus does not properly shift when clicking outside the cell.
Solution: To fix this, the scope of setTimeout was expanded to include the conditional statement for switchCellToViewMode.
Defect Fixes
How To Resolve
Issue 1, Calendar Overlay Position Issue
Solution: To resolve this, I added a setTimeout in the focus logic.
Issue 2, Calendar Overlay Cannot Select the Day Label Issue
focusOnElement()
andupdateStickyPosition()
are only invoked wheneditMode
,editing
, oreditingState
are updated.Issue 3, Focus Remains When Clicking Outside of the Cell
Calendar
), the cell remains focused.Solution: To fix this, the scope of
setTimeout
was expanded to include the conditional statement forswitchCellToViewMode
.Test
sample code
```js import { Calendar } from '@/components/lib/calendar/Calendar'; import { DataTable } from '@/components/lib/datatable/DataTable'; import { Column } from '@/components/lib/column/Column'; import { useState, useCallback } from 'react'; export function BasicDoc() { return ( <>TABLE
Before
https://github.com/user-attachments/assets/ab53197a-24c8-4ad1-ac1c-32e40ea487e1
After
https://github.com/user-attachments/assets/0323d7e8-42ef-46ef-b90a-9c8d6e593616