Problem/Motivation

Especially in the administration area, large tables can appear. This may also mean that table cells have several lines in some rows.

Currently, Gin middle-valigns table cell contents, which makes such tables hard to read.

Steps to reproduce

Open an administration page which shows a table, for example created by theme_table:

[
      '#theme' => 'table',
      '#header' => $header,
      '#rows' => $rows,
      '#empty' => $empty,
      [...]
];

with large contents in at least one cell. It's hard to read.

Proposed resolution

Set

td, th {
  vertical-align: top;
}

by default in Claro, as it's an Admin Theme, which should be able to handle such administrative UI elements like tables as well as possible.

Remaining tasks

- Discuss
- Implement
- Find possible conflicts (Views?)
- Test
- Release

User interface changes

Table contents are vertical-aligned top by default in Claro.

Before:

Screenshot of a View with lots of content before the change

After:

Screenshot of a View with lots of content after the change

API changes

None

Data model changes

None

Issue fork drupal-3405277

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Anybody created an issue. See original summary.

ravi kant’s picture

@Anybody
I try to find issue. Is this issue with default setup. I am looking on default setup of Drupal 10.2.0.
Please provide screenshot also.

saschaeggi’s picture

Status: Active » Postponed (maintainer needs more info)

@Anybody seems like a good candidate to move to Core as we can change the default for this in Claro. (it's not defined by Gin).

Would you mind either moving this issue or creating a new one in the core issue queue?

anybody’s picture

Project: Gin Admin Theme » Drupal core
Version: 8.x-3.x-dev » 11.x-dev
Component: Code » Claro theme

Thanks @saschaeggi! I agree! Moved to Drupal Core - Claro theme!

Fixing this, it might also make sense to take a general look at the default table styling (align, border, ... ) to fit the general Claro look.

anybody’s picture

Status: Postponed (maintainer needs more info) » Active

scott_euser made their first commit to this issue’s fork.

scott_euser’s picture

Issue summary: View changes
StatusFileSize
new167.33 KB
new178.4 KB

Created an MR (probably my CSS is wrong, I don't do front-end much so I haven't set up linter to match core).

Before and after added to issue summary. The issue becomes obvious when cell contents are vastly different from each other like in this example.

scott_euser’s picture

Status: Active » Needs review

Okay figured out how to run the linter, sorry for noise. Anyways ready for review.

thomas.frobieter’s picture

Status: Needs review » Reviewed & tested by the community

Perfect, looks good!

  • nod_ committed a3941f58 on 11.1.x
    Issue #3405277 by scott_euser, anybody: Add vertical-align: top as...

  • nod_ committed a1103610 on 11.x
    Issue #3405277 by scott_euser, anybody: Add vertical-align: top as...
nod_’s picture

Version: 11.x-dev » 11.1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed a11036104f to 11.x and a3941f583e to 11.1.x. Thanks!

ressa’s picture

Status: Fixed » Active
Related issues: +#3477466: Increase the minimum target sizes
StatusFileSize
new47.13 KB
new46.99 KB
new34.78 KB
new41.39 KB

I understand the thought behind this change, but it has unintended consequences all over the place, as I see it ... For example in the Token module modal, but also in Views, where the lines now are not aligned beautifully, but pushed to the top in tables and the Views UI.

Also, why do we need to update the th in the first place?

Drupal 11 - A Views table and Views interface adding a field

Table, before and after

Before, looks great
Tables before 1.1
After, header and lines at the top
Tables after 1.2

Views UI -- adding a field, before and after

Before, headers and lines are centered vertically, looking great
Views UI, before 2.1
After, headers and lines are pushed to the top
Views UI, after 2.2

Contrib modules, for example Token modal is also affected

Token overlap

See also this MP4 file: overlap.mp4

I think this needs to be rolled back, and given some more thought ...

  • nod_ committed ddf8b86e on 11.1.x
    Revert "Issue #3405277 by scott_euser, anybody: Add vertical-align: top...

  • nod_ committed de542f58 on 11.x
    Revert "Issue #3405277 by scott_euser, anybody: Add vertical-align: top...
nod_’s picture

Version: 11.1.x-dev » 11.x-dev
Status: Active » Needs work

you're right, reverted

anybody’s picture

Thanks for the feedback @ressa and sorry I didn't see that before!

Now the question is, are there any better ideas or CSS options to improve this?
I think we'll need to discuss this again in general... mhm, sad.

scott_euser’s picture

Wonder if we can make it a configuration option in Views table display plugin? So opt-in?

nod_’s picture

we can fix the uis where this makes sense, like the cell for tabledrag, the translation table, etc. not a by defa,ult thing

ressa’s picture

Title: Add vertical-align: top as default for table cells » Tall table cells push down other cells, which contain only a few words

No problem @anybody, it's only natural that sometimes some things happen elsewhere, when you improve Drupal :)
And thanks for a fast reversion @nod_.

Maybe the title could be updated, and refined afterwards? (I also thought about "Allow table cell content to stay at the top, as tall cells on same row").

saurav-drupal-dev’s picture

please correct me if i am on wrong direction as far i understood to fix the alignment how about using padding or transparent border to align it in middle.

saurav-drupal-dev’s picture

please correct me if i am on wrong direction as far i understood to fix the alignment how about using padding or transparent border to align it in middle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.