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

Multivalue fields with long text elements can break the layout #6365

Closed
laryn opened this issue Jan 15, 2024 · 10 comments · Fixed by backdrop/backdrop#4775
Closed

Multivalue fields with long text elements can break the layout #6365

laryn opened this issue Jan 15, 2024 · 10 comments · Fixed by backdrop/backdrop#4775

Comments

@laryn
Copy link
Contributor

laryn commented Jan 15, 2024

Description of the bug

Multivalue fields with long text elements can break the layout, as reported in these locations:

The first issue has a PR that is RTBC and likely to get into 1.27.0. However, @yorkshire-pudding and I have verified that the issue is not specific to CKEditor and is more general.

Cause

See backdrop-contrib/ckeditor5#125 (comment)

Solution

If we can fix the wider issue, then perhaps we can remove the CKE5-specific fix and avoid adding the same fix in multiple places. Adding this in system.theme.css right after the offending section solves both cases. Does that seem appropriate?

.field-multiple-table tr.odd .form-item,
.field-multiple-table tr.even .form-item {
  white-space: normal;
}
@herbdool
Copy link

Can we update this issue to elaborate on how to recreate the issue when not inserting long text into ckeditor 5? I can't recreate the bug in core, not with inserting long text into a text field with no editor, nor when putting long text into the help field in the field config.

@laryn
Copy link
Contributor Author

laryn commented Jan 15, 2024

@herbdool Thanks for looking. It looks like it may require a separate module to interact with it, which wraps the field with the long description in a multivalue table. e.g. Paragraphs, Multifield, Field Collection, custom code... If so, does that mean we leave it to each of those to fix if desired or is it still worth considering a broader fix in core?

@quicksketch
Copy link
Member

Looking at the offending CSS, I'm not sure what it is actually attempting to do. Perhaps there are places in core where a checkbox or radio button is within a table and the label should not be wrapped? I might be inclined to remove the white-space: nowrap; rule and fix any places in core that would be affected (though I can't find any at first look).

@laryn
Copy link
Contributor Author

laryn commented Jan 18, 2024

I had the same thought... it feels extremely heavy handed to add a general no-wrap at that level.

@herbdool
Copy link

Yes, let's get a PR for that. Removing that rule altogether and test for any breakages.

@herbdool
Copy link

herbdool commented Jun 3, 2024

@laryn I've added a PR here to just remove that line. We seem to be in agreement on that. Testers can see if it breaks any layouts in core.

I took a look at the history of that line. It's really old. I could only see back 14 years to when it was moved to the current file, but couldn't find anything before that linked to an issue to explain why it was added.

@klonos
Copy link
Member

klonos commented Jun 5, 2024

Perhaps there are places in core where a checkbox or radio button is within a table and the label should not be wrapped? I might be inclined to remove the white-space: nowrap; rule and fix any places in core that would be affected (though I can't find any at first look).

Testers can see if it breaks any layouts in core. ...

I vaguely recall something related with that and mobile/narrow screens. I'll have to test.

@quicksketch quicksketch modified the milestones: 1.28.1, 1.28.2 Jun 24, 2024
@jenlampton jenlampton modified the milestones: 1.28.2, 1.28.3 Jul 3, 2024
@jenlampton jenlampton modified the milestones: 1.28.3, 1.28.4 Sep 15, 2024
@quicksketch quicksketch modified the milestones: 1.28.4, 1.29.1 Sep 16, 2024
@quicksketch quicksketch modified the milestones: 1.29.1, 1.29.2 Oct 7, 2024
@quicksketch quicksketch modified the milestones: 1.29.2, 1.29.3 Nov 20, 2024
@herbdool
Copy link

Perhaps there are places in core where a checkbox or radio button is within a table and the label should not be wrapped? I might be inclined to remove the white-space: nowrap; rule and fix any places in core that would be affected (though I can't find any at first look).

I have not found in core any checkboxes or radio buttons with a label and that are in a table. As for other form fields, the Manage Fields of an entity does have form fields in a table, but nowrap is already set there in field_ui.css:

.field-ui-overview tr.add-new td {
  vertical-align: bottom;
  white-space: nowrap;
}

(That css was added in https://www.drupal.org/node/1164812)

With either css I can't see any difference if I disable the nowrap or not, regardless of screen size.

@laryn can you test? Would be good to get this in.

@quicksketch quicksketch modified the milestones: 1.29.3, 1.29.4 Jan 8, 2025
@quicksketch quicksketch modified the milestones: 1.29.4, 1.30.1 Jan 15, 2025
@laryn
Copy link
Contributor Author

laryn commented Feb 15, 2025

I do not see any issues with removing this line in my testing (which was basically clicking around to a bunch of admin pages with complex tables in them, to be fair).

@quicksketch
Copy link
Member

Thanks @laryn and @herbdool. With the manual testing by the 3 of us and finding no use-cases, that seems sufficient to remove this rule. If we do find a valid use-case, we'll remake the CSS for that situation, rather than blanket setting nowrap on all form items within all tables.

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

Successfully merging a pull request may close this issue.

5 participants