Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When scrolling horizontally, table header goes behind the first frozen column #6304

Closed
Weiko opened this issue Jul 17, 2024 · 4 comments
Closed

Comments

@Weiko
Copy link
Member

Weiko commented Jul 17, 2024

Bug Description

When scrolling horizontally, table header goes behind the first frozen column and becomes visible again when we scroll too much.
See video below

Screen.Recording.2024-07-17.at.11.16.34.mov

Expected behavior

I should not see table header of other columns

@Weiko
Copy link
Member Author

Weiko commented Jul 17, 2024

FYI @charlesBochet @lucasbordeau

Copy link
Contributor

greptile-apps bot commented Jul 17, 2024

To fix the issue where the table header goes behind the first frozen column when scrolling horizontally, follow these steps:

  1. Update RecordTable.tsx: Ensure the StyledTable component has proper z-index handling for the header.
const StyledTable = styled.table`
  border-radius: ${({ theme }) => theme.border.radius.sm};
  border-spacing: 0;
  margin-right: ${({ theme }) => theme.table.horizontalCellMargin};
  table-layout: fixed;
  width: calc(100% - ${({ theme }) => theme.table.horizontalCellMargin} * 2);
  thead {
    position: sticky;
    top: 0;
    z-index: 2; // Ensure header is above other elements
  }
`;
  1. Update RecordTableTd.tsx: Ensure the first column has a higher z-index when frozen.
const StyledTd = styled.td<{
  zIndex?: number;
  backgroundColor: string;
  borderColor: string;
  isDragging?: boolean;
  fontColor: string;
  sticky?: boolean;
  freezeFirstColumns?: boolean;
  left?: number;
  hasRightBorder?: boolean;
  hasBottomBorder?: boolean;
}>`
  // existing styles
  ${({ sticky }) =>
    sticky
      ? `
      position: sticky;
      left: 0;
      z-index: 3; // Ensure frozen column is above other elements
    `
      : ''}
`;
  1. Update RecordTableFirstColumnScrollObserver.tsx: Ensure the class toggling for the frozen column shadow is correct.
useEffect(() => {
  const element = recordTableRef.current;
  if (element) {
    if (scrollLeft > 0) {
      element.classList.add('freeze-first-columns-shadow');
    } else {
      element.classList.remove('freeze-first-columns-shadow');
    }
  }
}, [scrollLeft, recordTableRef]);

These changes should ensure that the table header remains above the first frozen column when scrolling horizontally.

References

/packages/twenty-front/src/modules/object-record/record-table/components/RecordTable.tsx
/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableTd.tsx
/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableFirstColumnScrollObserver.tsx

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Ask Greptile · Edit Issue Bot Settings

@Antardas
Copy link
Contributor

@Weiko , @Bonapara .
Hello, I have created a PR on this issue.
#6315

lucasbordeau pushed a commit that referenced this issue Jul 19, 2024
@lucasbordeau
Copy link
Contributor

FIxed by #6315

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Product development ✅ Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants