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

fix(markdown): allow horizontal scrolling in nested HTML tables #3466

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Kiarokh
Copy link
Contributor

@Kiarokh Kiarokh commented Feb 27, 2025

test a big table

Paste this MD code in a markdown example:

| Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 | Column 7 | Column 8 | Column 9 | Column 10 |
|----------|----------|----------|----------|----------|----------|----------|----------|----------|-----------|
| Data 1   | Data 2   | Data 3   | Data 4   | Data 5   | Data 6   | Data 7   | Data 8   | Data 9   | Data 10   |
| Info A   | Info B   | Info C   | Info D   | Info E   | Info F   | Info G   | Info H   | Info I   | Info J    |
| Test 1   | Test 2   | Test 3   | Test 4   | Test 5   | Test 6   | Test 7   | Test 8   | Test 9   | Test 10   |

fix https://github.com/Lundalogik/limepkg-email/issues/1303

Review:

  • Commits are atomic
  • Commits have the correct type for the changes made
  • Commits with breaking changes are marked as such

Browsers tested:

(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)

Windows:

  • Chrome
  • Edge
  • Firefox

Linux:

  • Chrome
  • Firefox

macOS:

  • Chrome
  • Firefox
  • Safari

Mobile:

  • Chrome on Android
  • iOS

Summary by CodeRabbit

  • Style
    • Improved the visual presentation of tables with enhanced borders and refined spacing.
    • Enabled horizontal scrolling for wide tables, ensuring they display more effectively on smaller screens.

@Copilot Copilot bot review requested due to automatic review settings February 27, 2025 15:06

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Copy link

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3466/

@adrianschmidt adrianschmidt force-pushed the markdown-nested-html-tables branch from 907b7fd to da87572 Compare March 2, 2025 15:58
Copy link

coderabbitai bot commented Mar 2, 2025

Walkthrough

The pull request updates the SCSS styling for tables. It introduces a new tbody block with border and border-radius properties to visually separate the table body. Additionally, it modifies the table styling by setting its display to block and adding properties such as box-sizing, overflow-x, and max-width, which enable horizontal scrolling for wide tables. There are no changes to exported or public entities.

Changes

File(s) Change Summary
src/components/markdown/partial-styles/_tables.scss Added a new tbody block with border and border-radius styles; updated the table block to use display: block along with box-sizing, overflow-x, and max-width properties to improve responsiveness and allow horizontal scrolling.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0869328 and da87572.

📒 Files selected for processing (1)
  • src/components/markdown/partial-styles/_tables.scss (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Docs / Publish Docs
  • GitHub Check: Test
  • GitHub Check: Build
🔇 Additional comments (2)
src/components/markdown/partial-styles/_tables.scss (2)

10-17: Table Block Styling within the Host Scoped Rule
The table styling defined within the :host(limel-markdown:not(.no-table-styles)) selector is clear and consistent. The properties (e.g., table-layout: auto, min-width: 100%, and margin settings) ensure that tables inherit a flexible layout inside the component.


64-64: Closing the :host Block Correctly
The closing brace at line 64 correctly terminates the style block for the :host(limel-markdown:not(.no-table-styles)) rule. No issues noted here.

Comment on lines +19 to 22
tbody {
border: 1px solid rgb(var(--contrast-400));
border-radius: 0.25rem;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

New tbody Styling: Border and Border-Radius Addition
The addition of a tbody block with a border and border-radius enhances the visual separation of the table body. However, please verify that applying border-radius on the tbody element produces consistent results across all target browsers and email clients, as some browsers may handle border-radius on table sections differently.

If needed, I can help set up cross-browser tests to validate this styling.

Comment on lines +65 to +76
table {
// This enables very wide tables to be scrollable on small
// containers. However, since the default is `display: table`,
// these styles could potentially create other misalignment or
// layout issues. For example, small tables won't be 100% wide
// anymore. I have accepted this tradeoff and have not yet
// found anything too horrible or better solution. /Kia
display: block;
box-sizing: border-box;
overflow-x: auto;
max-width: 100%;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Enabling Horizontal Scrolling for Tables Outside the Host
The new table block defined from lines 65 to 76 successfully implements horizontal scrolling for wide tables by using display: block, overflow-x: auto, and max-width: 100%. The explanatory comments clearly describe the tradeoffs involved.

For enhanced mobile support (especially on iOS), consider adding the -webkit-overflow-scrolling: touch; property to enable smoother scrolling. For example:

-    overflow-x: auto;
+    overflow-x: auto;
+    -webkit-overflow-scrolling: touch;

This change can improve the overall user experience on mobile devices.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
table {
// This enables very wide tables to be scrollable on small
// containers. However, since the default is `display: table`,
// these styles could potentially create other misalignment or
// layout issues. For example, small tables won't be 100% wide
// anymore. I have accepted this tradeoff and have not yet
// found anything too horrible or better solution. /Kia
display: block;
box-sizing: border-box;
overflow-x: auto;
max-width: 100%;
}
table {
// This enables very wide tables to be scrollable on small
// containers. However, since the default is `display: table`,
// these styles could potentially create other misalignment or
// layout issues. For example, small tables won't be 100% wide
// anymore. I have accepted this tradeoff and have not yet
// found anything too horrible or better solution. /Kia
display: block;
box-sizing: border-box;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
max-width: 100%;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant