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

[lexical-playground] Bug Fix: Allow scrolling if the table cell content overflows #6966

Merged
merged 3 commits into from
Dec 14, 2024

Conversation

Parasaran-Python
Copy link
Contributor

@Parasaran-Python Parasaran-Python commented Dec 14, 2024

fix 6931: CSS changes in the playground to allow scrolling if the cell content overflows, and inheriting the same behavior for the nested <p> tag.

Bug Fix

Description

Describe the changes in this pull request
Made changes to the playground CSS to allow scroll of table content, since there's a nested p tag, have added scroll:inherit to it

Closes #6931

Test plan

Try scrolling of various contents inside playground table's cells

Before

Insert relevant screenshots/recordings/automated-tests
image

After

bandicam.2024-12-14.16-49-17-307.mp4

Insert relevant screenshots/recordings/automated-tests

…l content overflows, and inheriting the same behavior for the nested <p> tag.
Copy link

vercel bot commented Dec 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2024 6:01pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 14, 2024 6:01pm

@facebook-github-bot
Copy link
Contributor

Hi @Parasaran-Python!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copy link

github-actions bot commented Dec 14, 2024

size-limit report 📦

Path Size
lexical - cjs 31.2 KB (0%)
lexical - esm 31.04 KB (0%)
@lexical/rich-text - cjs 40.16 KB (0%)
@lexical/rich-text - esm 32.95 KB (0%)
@lexical/plain-text - cjs 38.77 KB (0%)
@lexical/plain-text - esm 30.16 KB (0%)
@lexical/react - cjs 42.05 KB (0%)
@lexical/react - esm 34.24 KB (0%)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 14, 2024
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

etrepum
etrepum previously approved these changes Dec 14, 2024
Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

Overall I think the overflow is useful for table cells, but unsure why it was also applied to the nested p tag. Can you explain or demonstrate why that is useful?

@@ -15,6 +15,7 @@
.PlaygroundEditorTheme__paragraph {
margin: 0;
position: relative;
overflow: inherit;
Copy link
Collaborator

Choose a reason for hiding this comment

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

In what situations would it be useful for this nested p tag to scroll separately?

Copy link
Contributor Author

@Parasaran-Python Parasaran-Python Dec 14, 2024

Choose a reason for hiding this comment

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

without this the image doesnt scroll, the p tag seems to be blocking the scroll of the image as the image is eventually inside the p.

I could have very well applied the overflow prop to the p tag directly, but i felt it made more sense to apply it to td tag, and inherit to the child p tag

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, the td tag needs it for sure. If remove this change with dev tools in a locally copy I can still scroll the cell horizontally. The only difference from here appears to be that the image gets clipped by the td padding on the right when it is enabled.

Screen.Recording.2024-12-14.at.08.28.23.mov

Copy link
Contributor Author

@Parasaran-Python Parasaran-Python Dec 14, 2024

Choose a reason for hiding this comment

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

Works for me as well in chrome, didnt work for me in firefox, hence I had to add it.

Seems like this is a browser specific thing, I hope even you would face the same issue in a firefox instance.

Not sure how the behavior would be on safari!

PS: May be chrome implicitly inherits the parent CSS and firefox doesnt! Not sure.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This does look like a firefox-specific issue, which is "fixed" but currently behind a feature flag that defaults to false https://bugzilla.mozilla.org/show_bug.cgi?id=1904159

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a great example of why cross-browser testing is so important! 😅

Regarding this PR, it might be safer to go ahead with this change, unless there's a risk of any potential breakage. What are your thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure let me do that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that I've had a bit more time to think about this, let's move this to a separate CSS rule that specifically targets any direct descendant of the table cell. This both covers the intent of the change and is more correct (will work for other top-level blocks, not just ParagraphNode).

/*
  A firefox workaround to allow scrolling of overflowing table cell
  ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1904159
*/
.PlaygroundEditorTheme__tableCell > * {
  overflow: inherit;
}

Copy link
Contributor Author

@Parasaran-Python Parasaran-Python Dec 14, 2024

Choose a reason for hiding this comment

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

Yes, makes sense, will try this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is done.

@etrepum etrepum changed the title fix 6931: CSS changes in the playground to allow scrolling if the cell content overflows, and inheriting the same behavior for the nested <p> tag. [lexical-playground] Bug Fix: Allow scrolling if the table cell content overflows Dec 14, 2024
@Parasaran-Python
Copy link
Contributor Author

Comment has been added @etrepum requesting you to re-review. 🙂

Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

Works great, thank you!

@etrepum etrepum enabled auto-merge December 14, 2024 18:14
@etrepum etrepum added this pull request to the merge queue Dec 14, 2024
Merged via the queue into facebook:main with commit 70cfd2f Dec 14, 2024
37 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Image becomes unresizable if embedded inside a table
3 participants