Skip to content

Fix: last column not visible in 2x2 tables on mobile and tablet views#6258

Open
jsmitrah26 wants to merge 2 commits into
adobecom:stagefrom
jsmitrah26:table-preserve-column
Open

Fix: last column not visible in 2x2 tables on mobile and tablet views#6258
jsmitrah26 wants to merge 2 commits into
adobecom:stagefrom
jsmitrah26:table-preserve-column

Conversation

@jsmitrah26

@jsmitrah26 jsmitrah26 commented Jul 7, 2026

Copy link
Copy Markdown

Resolves: MWPW-199959

Description

As part of exploring the Adobe Blog components in Milo, I identified an issue with the Table block's responsive column display. I investigated the root cause, implemented a fix, and contributed the changes.

When a Table block contains exactly two columns, the first column becomes hidden on mobile and tablet viewports, leaving only one column visible. This change automatically preserves both columns for two-column tables, ensuring they remain visible and accessible across smaller viewports while keeping the existing behavior unchanged for tables with more than two columns.

Steps to Reproduce

  1. Add a Table block with exactly two columns.
  2. View the page on a mobile or tablet viewport.

Expected: Both columns remain visible.

Actual: The first column is hidden, leaving only one column visible.

Test URLs

Before: https://main--mitrah-milo-hub--jsmitrah26.aem.live/table-block

After: https://main--mitrah-milo-hub--jsmitrah26.aem.live/table-block?milolibs=table-preserve-column--milo--jsmitrah26

@jsmitrah26
jsmitrah26 force-pushed the table-preserve-column branch from 7eb4a99 to 92d6167 Compare July 9, 2026 07:13
@jsmitrah26
jsmitrah26 marked this pull request as ready for review July 9, 2026 10:16
@jsmitrah26
jsmitrah26 requested a review from a team as a code owner July 9, 2026 10:16
Comment thread libs/blocks/table/table.css Outdated
}

.table.preserve-columns .section-row-title {
grid-column: auto !important;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can selector be adjusted so we can avoid !important ?

Comment thread libs/blocks/table/table.css Outdated

.table.preserve-columns .col-heading.col-1,
.table.preserve-columns .row-highlight .col-highlight.col-1 {
display: flex !important;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as above.

Comment thread libs/blocks/table/table.js Outdated
Comment on lines +480 to +482
if (table.classList.contains('preserve-columns')) {
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit;

Suggested change
if (table.classList.contains('preserve-columns')) {
return;
}
if (table.classList.contains('preserve-columns')) return;

Comment thread libs/blocks/table/table.js Outdated
Comment on lines +682 to +684
if (columnCount <= 2) {
el.classList.add('preserve-columns');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
if (columnCount <= 2) {
el.classList.add('preserve-columns');
}
if (columnCount <= 2) el.classList.add('preserve-columns');

Comment thread libs/blocks/table/table.js Outdated
Comment on lines +679 to +680
const firstRow = el.querySelector('.row-1');
const columnCount = firstRow?.children.length || 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
const firstRow = el.querySelector('.row-1');
const columnCount = firstRow?.children.length || 0;
const columnCount = el.querySelector('.row-1')?.children.length || 0;

@jsmitrah26

Copy link
Copy Markdown
Author

Thanks for the review, @zagi25 !

I've addressed all the feedback and pushed the latest changes, including the CSS specificity update and the suggested JS improvements. Thanks!

@zagi25

zagi25 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

@jsmitrah26 has this been run by Consonant or anyone else ? Although it does fix the issue it changes look of the table, currently rows are stacked, with your fix they stay as columns.
Before:
Screenshot 2026-07-10 at 14 58 13
After:
Screenshot 2026-07-10 at 14 58 03

@jsmitrah26

Copy link
Copy Markdown
Author

Hi @zagi25 , Thanks for pointing this out. This hasn't been reviewed by the Consonant team yet.

While exploring the Table block, I noticed this issue specifically with two-column tables, where the mobile/tablet column selector isn't available, resulting in one column being hidden with no way to access it.

That's why I decided to work on a fix for this specific case. I also discussed this with my colleague VenkateshMitrah, who is a vendor worker on Adobe. He pointed me to the related tickets (MWPW-194499 and MWPW-188525) and explained that they are currently on hold until the site redesign.

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.

2 participants