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 #494 : block title overflow behaviour #495

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Pawankalyan2023
Copy link

@Pawankalyan2023 Pawankalyan2023 commented Jan 1, 2025

Motivation

Fixed Block Title Overflow: Updated the visual editor CSS to ensure overflowed text breaks and wraps within the container, maintaining a clean and responsive layout.

Fixes # 494

Type of change:

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added unit tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@marrouchi marrouchi linked an issue Jan 1, 2025 that may be closed by this pull request
Comment on lines +127 to +129
word-break: break-word;
overflow-wrap: break-word;
justify-content: flex-start;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hello @Pawankalyan2023 , thank you for your contribution.

How about we use css elipses instead

text-overflow: ellipsis;

Copy link
Author

Choose a reason for hiding this comment

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

This might not be a good choice when we need to showcase the title completely to the user for better understanding.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can show the whole text on hover :

.truncated {
  white-space: nowrap; 
  overflow: hidden;
  text-overflow: ellipsis; 
}
<div class="truncated" title="This is a long text that will be truncated, but showed on hover">
  This is a long text that will be truncated, but shown on hover
</div>

Copy link
Contributor

Choose a reason for hiding this comment

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

Another way of doing it :

.ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative; /* Necessary for positioning the pseudo-element */
}

.ellipsis:hover::after {
    content: attr(data-full-title); /* Fetch the full text from the `data-full-text` attribute */
    position: absolute;
    top: 100%; /* Show below the element */
    left: 0;
    background-color: #fff; /* Optional: Style for visibility */
    color: #000;
    padding: 5px;
    border: 1px solid #ccc;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    white-space: nowrap;
}

<div class="ellipsis" data-full-title="This is the full text that will be shown on hover.">
    This is the full title that will...
</div>

Copy link
Author

Choose a reason for hiding this comment

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

Hey @marrouchi I made the changes to the code with ellipses , could you please review this

Screen.Recording.2025-01-06.214723.mp4

Copy link
Author

Choose a reason for hiding this comment

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

@marrouchi is this okay ?

@medchedli medchedli added the SWOC Social Winter of Code 2025 label Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SWOC Social Winter of Code 2025
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🤔 [ISSUE] - block title overflow behaviour
3 participants