Skip to content

Conversation

@devongovett
Copy link
Member

@devongovett devongovett commented Jul 26, 2024

See followups that still need to be implemented here: RSP Component Milestones (view)

devongovett and others added 30 commits July 26, 2024 15:13
row focus ring needs row render function first
this will need changes to RAC table as well....
…utton focus visible

also tested moving the sort descriptor in front of the column text andwithout reserving room
@rspbot
Copy link

rspbot commented Sep 17, 2024

}

// TODO: Note that loadMore and loadingState are now on the Table instead of on the TableBody
export interface TableProps extends Omit<RACTableProps, 'style' | 'disabledBehavior' | 'className' | 'onRowAction' | 'selectionBehavior' | 'onScroll' | 'onCellAction' | 'dragAndDropHooks'>, StyleProps, S2TableProps {
Copy link
Member Author

Choose a reason for hiding this comment

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

Since table allows overriding the height, we should extends UnsafeStyles here and add styles using StylesPropWithHeight.

Copy link
Member

Choose a reason for hiding this comment

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

good call, I'm not sure why it didn't complain in story where I make use of both height and width via styles hmm

<InternalTableContext.Provider value={context}>
<RACTable
ref={scrollRef}
style={{WebkitTransform: 'translateZ(0)'}}
Copy link
Member Author

Choose a reason for hiding this comment

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

only webkit? What is this fixing?

Copy link
Member

@LFDanLu LFDanLu Sep 17, 2024

Choose a reason for hiding this comment

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

yep, webkit only, this fixes the issue of checkboxes appearing above the scrollbar, I'll add a comment
image

let loadMoreSpinner = (
<UNSTABLE_TableLoadingIndicator className={style({height: 'full', width: 'full'})}>
<div className={centeredWrapper}>
<ProgressCircle
Copy link
Member Author

Choose a reason for hiding this comment

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

well we should probably ask spectrum. I still think smaller is better, or maybe it should depend on the density.

<Collection items={items}>
{children}
</Collection>
{loadingState === 'loadingMore' && [...items].length > 0 && loadMoreSpinner}
Copy link
Member Author

Choose a reason for hiding this comment

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

Why the length check here but not below? I'd be a little concerned about performance of the spread as well so if we can avoid it that would be good.

Copy link
Member Author

Choose a reason for hiding this comment

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

We should probably also discuss how table should support ghost loading at some point, and what the default should be.

Copy link
Member

Choose a reason for hiding this comment

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

the length check here is to prevent a situation where somehow the `loadingState = "loadingMore"' but no items are actually loaded aka the below:
image

For loadingState = "loading" we don't need these checks because the rendering of that circle/empty state is provided to renderEmptyState instead so RAC table handles rendering it only when the collection size is 0.

We could consider the "loadingMore" case a user error and get rid of the length check perhaps, what do you think? Otherwise I need some way of knowing the collection is empty...

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm yeah I'd consider that programmer error I think

Copy link
Member

Choose a reason for hiding this comment

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

sounds good, removed the check


function CellFocusRing(props: {isFocusVisible: boolean}) {
let {isFocusVisible} = props;
return <div role="presentation" style={{position: 'absolute', top: 0, left: 0, bottom: 0, right: 0}} className={style({...cellFocus})({isFocusVisible})} />;
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
return <div role="presentation" style={{position: 'absolute', top: 0, left: 0, bottom: 0, right: 0}} className={style({...cellFocus})({isFocusVisible})} />;
return <div role="presentation" style={{position: 'absolute', inset: 0}} className={style({...cellFocus})({isFocusVisible})} />;

Or actually, why are the position properties inline instead of in the style macro?

Copy link
Member

Choose a reason for hiding this comment

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

ah it previously was but the cellFocus gets reused in other places so I put this inline to ensure it didn't propagate elsewhere unexpectedly. I dunno why I didn't put it in the style macro in the className, whoops will do thanks!

insetEnd: size(-6),
cursor: {
default: 'none',
resizableDirection: {
Copy link
Member Author

Choose a reason for hiding this comment

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

Eventually we need our custom cursors here like we had in S1?

Copy link
Member

Choose a reason for hiding this comment

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

oh thats right, completely slipped my mind, missed it since I didn't tag it with TODO lol. I'll add it to the followup ticket and see if we need to submit something to the icons team

Copy link
Member

Choose a reason for hiding this comment

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

filed an airtable ticket for those cursors

Comment on lines 682 to 685
// TODO: Need to wait for the menu to fully transition out, otherwise mouse movements may hover the menu items and steal focus from the resizer,
// causing resizing to end prematurely due to blur. Open to ideas for how to handle this since it affects RAC. Ideally we'd freeze
// focus from being able to move if we are in resizing mode except if the user clicks away or moves focus with something other than hover
setTimeout(() => startResize(), 200);
Copy link
Member Author

Choose a reason for hiding this comment

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

We could mark popovers/overlays as inert when they are transitioning out maybe

import {useMediaQuery} from '@react-spectrum/utils';

export function useIsMobileDevice(): boolean {
return useMediaQuery('(max-width: 640px)');
Copy link
Member Author

Choose a reason for hiding this comment

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

Since this is being used to determine the scale, shouldn't it look for @media not ((hover: hover) and (pointer: fine)), which is what the style macro uses for that?

Copy link
Member

Choose a reason for hiding this comment

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

I considered doing that but I figured we'd want to follow a similar logic style that we had in S1 in preparation for Trays aka we would check screen size. If we use the touch media query that the style macro uses, that would match large screen touch devices right?

Copy link
Member Author

Choose a reason for hiding this comment

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

But this is being used to determine pixel sizes not whether to show a tray right? The style macro uses the media query I posted to do the same thing, ie scale up dimensions by 25%. Whether to show a tray is indeed based on screen size but that's different from touch scale, which might also occur on large screen devices like iPads or laptops.

Copy link
Member

Choose a reason for hiding this comment

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

ahh right, makes sense, guess I conflated the two. I'll make a separate useScale that uses the media query and use it for table

… doesnt get canceled

if the user clicks the resize option and hovers another item while the popover is transitioning out it can cause resizing to be canceled. This prevents that case from happening
@rspbot
Copy link

rspbot commented Sep 18, 2024

… check

warning is a compat one for React 19, items check is uneeded due to user error
@rspbot
Copy link

rspbot commented Sep 18, 2024

@rspbot
Copy link

rspbot commented Sep 19, 2024

user = userEvent.setup({delay: null, pointerMap});
});
it('provides slots', async () => {
// Mock console.error for React Canary "Received the string `true` for the boolean attribute `inert`." warning
Copy link
Member

Choose a reason for hiding this comment

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

So these errors are going to appear in downstream projects tests as well

slot={props.slot || undefined}
style={style}
// @ts-ignore - React < 19 compat
inert={(isEntering || isExiting) ? 'true' : undefined}
Copy link
Member

Choose a reason for hiding this comment

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

what is actually the issue?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is causing focus not to move into the popover when it opens now. e.g. try opening the column header menu with a keyboard - focus stays on the header instead of going to the menu item.

Copy link
Member Author

Choose a reason for hiding this comment

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

Reverted the inert change and used pointer-events: none instead so it only applies to mouse during the exit animation.

# Conflicts:
#	packages/@react-spectrum/s2/stories/Table.stories.tsx
#	packages/react-aria-components/test/ComboBox.test.js
#	packages/react-aria-components/test/Select.test.js
…resizing doesnt get canceled"

This reverts commit 9cfb896.
This reverts commit 7006a76.

# Conflicts:
#	packages/react-aria-components/test/ComboBox.test.js
#	packages/react-aria-components/test/Select.test.js
It has a bunch of internal stuff on it. We don't need the exact height for the resizer, we just need a large enough value that it goes past the end of the table. 100vh should work.
@rspbot
Copy link

rspbot commented Sep 25, 2024

@devongovett
Copy link
Member Author

I approve! ✅

(GitHub won't let me since I opened the PR 😂)

@devongovett devongovett added this pull request to the merge queue Sep 25, 2024
Merged via the queue into main with commit 5bb6a22 Sep 25, 2024
3 checks passed
@devongovett devongovett deleted the s2-table branch September 25, 2024 19:17
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.

9 participants