Skip to content

Column header with menu alignment#3907

Merged
snowystinger merged 4 commits into
mainfrom
column-header-menu-alignment
Jan 13, 2023
Merged

Column header with menu alignment#3907
snowystinger merged 4 commits into
mainfrom
column-header-menu-alignment

Conversation

@snowystinger
Copy link
Copy Markdown
Member

Closes #3880

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Go to new story, ?path=/story/tableview--should-fill-cell-width-allowsresizing
column headers should all match as they do in the non-resizing story just before it, it may be easiest to have both stories open and switch between the tabs

Menu chevron should always be visible if there is a menu

🧢 Your Project:

@snowystinger snowystinger changed the title Column header menu alignment Column header with menu alignment Jan 11, 2023
@devongovett
Copy link
Copy Markdown
Member

Should the alignment of the menu itself also change? Looks like it's still start aligned.
image

@snowystinger
Copy link
Copy Markdown
Member Author

@devongovett the one odd case is center alignment since we don't have center alignment of MenuTrigger, though maybe this is a good reason to expose that? thoughts?

@devongovett
Copy link
Copy Markdown
Member

Ehhhh I think it's fine as is, doesn't feel like a big enough deal to add a whole new feature to menu

@rspbot
Copy link
Copy Markdown

rspbot commented Jan 13, 2023

@rspbot
Copy link
Copy Markdown

rspbot commented Jan 13, 2023

## API Changes

unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }

Copy link
Copy Markdown
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

Alignment looks good to me, tested in various locales + column sizes. Some things I noticed when testing, just thought I'd bring them up

Comment thread packages/@react-spectrum/table/stories/Table.stories.tsx
let showResizer = !isEmpty && ((headerRowHovered && getInteractionModality() !== 'keyboard') || resizingColumn != null);
let alignment = 'start';
let menuAlign = 'start' as 'start' | 'end';
if (columnProps.align === 'center' || column.colspan > 1) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unrelated to the PR, but this reminded me that nested columns were a thing so I tried adding resizing to those stories:
image

Noted that I couldn't resize the parent columns, not sure we want to support that right now/may need to discuss the behavior there. Do we wanna disable resizing for columns with children for now? Happy to open a PR if so.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I have not done anything with parent columns, I'm not sure how that would work. Maybe it'd be good to disable it from being an option to even set that prop somehow...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about we add a warning in TableView if column.hasChildNodes + allowsResizing is provided. We could then add a couple checks in other places to prevent a column from rendering as a resizable column if it has childNodes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I guess, do actions still matter for combined columns?
I'll merge this one and make a follow up to discuss

@snowystinger snowystinger merged commit 3d6d506 into main Jan 13, 2023
@snowystinger snowystinger deleted the column-header-menu-alignment branch January 13, 2023 21:32
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.

TableView - allowsResizing is breaking style for columns with align=end

4 participants