Skip to content

AdvancedTable - Column resizing #2849

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

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

Conversation

zamoore
Copy link
Contributor

@zamoore zamoore commented May 2, 2025

📌 Summary

If merged, this PR will allow users to resize AdvancedTable columns.

🛠️ Detailed description

  • Adds a new column model alongside the existing table and row models.

Added components

  • Hds::AdvancedTable::ThContextMenu: Right now just includes an option for resetting the column width to its initial value
    Screenshot 2025-05-29 at 3 15 24 PM
  • Hds::AdvancedTable::ThResizeHandle: A div that acts as a border handle for click-and-drag resizing on resizable AdvancedTable columns.
    Screenshot 2025-05-29 at 3 14 40 PM

Added dependencies

  • ember-math-helpers

📸 Screenshots

toggle

🔗 External links

Jira ticket: HDS-4585
Figma file: Figma


👀 Component checklist

💬 Please consider using conventional comments when reviewing this PR.

Copy link

vercel bot commented May 2, 2025

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

Name Status Preview Updated (UTC)
hds-showcase ✅ Ready (Inspect) Visit Preview Jun 5, 2025 5:27pm
hds-website ✅ Ready (Inspect) Visit Preview Jun 5, 2025 5:27pm

@zamoore zamoore force-pushed the zamoore/hds-4585/AdvancedTable/column-resizing branch from 79a538c to 9bd84b3 Compare May 7, 2025 20:31
border-radius: 3px;

&:hover,
&.mock-hover {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
&.mock-hover {
&.mock-hover,
&:focus,
&.mock-focus {

[Question] Should the focus state also have these hover state styles? Right now the focus state does not have the white background or black icon.
Screenshot 2025-06-05 at 1 21 40 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

Good question, I'm not overly opinionated, but I do think that leaving out the white background and the change in icon color on focus is fine.


&:focus,
&.mock-focus {
border-color: transparent;
Copy link
Contributor

Choose a reason for hiding this comment

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

[Question] When the menu is open, the hover state for the button does not have a border. Should it match the hover state for when it is closed? This is noticeable when you click to open the menu and the border gets removed from the button.
Screenshot 2025-06-05 at 1 21 06 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

I dropped a follow-up comment about this on this thread. When the menu is open, the focus ring should persist (at least that's how our other dropdown components function.

Copy link
Contributor

Choose a reason for hiding this comment

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

[Suggestion] Can you add a section at the bottom for the ThContextMenu and show the different states as is done for the other buttons and icons?

display: block;
width: 100%;
min-width: 30px;
overflow: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

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

[Suggestion] Not sure if this is doable, but could we apply these styles limiting the header text to one line to all
column headers if any of the columns are resizable? In one example the last column is wrapping to two lines when the column before it is increased even though it doesn't need to. The table will overflow anyway so the column doesn't need to go to two lines.

Screen.Recording.2025-06-05.at.1.36.17.PM.mov

export default class HdsAdvancedTableThContextMenu extends Component<HdsAdvancedTableThContextMenuSignature> {
originalColumnWidth?: string = this.args.column.width;

get classNames() {
Copy link
Contributor

Choose a reason for hiding this comment

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

[Nit] since it's only one class could just add it in the template

}

.hds-advanced-table__th-context-menu .hds-dropdown-toggle-icon {
width: 24px;
Copy link
Contributor

Choose a reason for hiding this comment

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

[Suggestion] Might be worth creating a variable for this width and using it for all the buttons (tooltip, sort, expand)

color: var(--token-color-foreground-faint);
background-color: transparent;
border: 1px solid transparent;
border-radius: 3px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
border-radius: 3px;
border-radius: var(--token-border-radius-x-small);

bottom: 0;
left: 0;
border: none;
border-radius: 3px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
border-radius: 3px;
border-radius: var(--token-border-radius-x-small);

Copy link
Contributor

@jorytindall jorytindall left a comment

Choose a reason for hiding this comment

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

Followed up on a few threads, I'm seeing another bug with the focus state (that @dchyun caught as well), and I'm still seeing a discrepancy in the border radius on the resizable column sorting table when a column is sorted.

border-radius: 3px;

&:hover,
&.mock-hover {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good question, I'm not overly opinionated, but I do think that leaving out the white background and the change in icon color on focus is fine.


&:focus,
&.mock-focus {
border-color: transparent;
Copy link
Contributor

Choose a reason for hiding this comment

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

I dropped a follow-up comment about this on this thread. When the menu is open, the focus ring should persist (at least that's how our other dropdown components function.

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

Successfully merging this pull request may close these issues.

6 participants