Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion starters/docs/src/Table.css
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
border-color: transparent;
border-radius: var(--radius-sm);

&[data-focus-visible] {
&:focus-visible {

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.

why?

outline: 2px solid var(--focus-ring-color);
outline-offset: 2px;
}
Expand Down
5 changes: 2 additions & 3 deletions starters/docs/src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
TableFooter as AriaTableFooter,
type TableFooterProps
} from 'react-aria-components/Table';
import {Group} from 'react-aria-components/Group';
import {composeRenderProps} from 'react-aria-components/composeRenderProps';
import {Checkbox} from './Checkbox';
import {ProgressCircle} from './ProgressCircle';
Expand All @@ -41,9 +40,9 @@ export function Column(props: Omit<ColumnProps, 'children'> & {children?: React.
<AriaColumn {...props} className="react-aria-Column button-base">
{({allowsSorting, sortDirection}) => (
<div className="column-header">
<Group role="presentation" tabIndex={-1} className="column-name">
<div role={allowsSorting ? 'button' : undefined} tabIndex={-1} className="column-name">

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.

Was there a reason you didn't do this?

Suggested change
<div role={allowsSorting ? 'button' : undefined} tabIndex={-1} className="column-name">
<div role={allowsSorting ? 'button' :'presentation'} tabIndex={-1} className="column-name">

{props.children}
</Group>
</div>
{allowsSorting && (
<span aria-hidden="true" className="sort-indicator">
{sortDirection === 'ascending' ? <ChevronUp size={16} /> : <ChevronDown size={16} />}
Expand Down
11 changes: 4 additions & 7 deletions starters/tailwind/src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
TableFooter as AriaTableFooter,
type TableFooterProps
} from 'react-aria-components/Table';
import {Group} from 'react-aria-components/Group';
import {composeRenderProps} from 'react-aria-components/composeRenderProps';
import {twMerge} from 'tailwind-merge';
import {tv} from 'tailwind-variants';
Expand All @@ -49,10 +48,8 @@ export function Table(props: TableProps) {
);
}

const columnStyles = tv({
extend: focusRing,
base: 'px-2 h-5 box-border flex-1 flex gap-1 items-center overflow-hidden'
});
const columnStyles =
'px-2 h-5 box-border flex-1 flex gap-1 items-center overflow-hidden outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 dark:focus-visible:outline-blue-500 forced-colors:focus-visible:outline-[Highlight]';

const resizerStyles = tv({
extend: focusRing,
Expand All @@ -69,7 +66,7 @@ export function Column(props: ColumnProps) {
)}>
{composeRenderProps(props.children, (children, {allowsSorting, sortDirection}) => (
<div className="flex items-center">
<Group role="presentation" tabIndex={-1} className={columnStyles}>
<div role={allowsSorting ? 'button' : undefined} tabIndex={-1} className={columnStyles}>
<span className="truncate">{children}</span>
{allowsSorting && (
<span
Expand All @@ -84,7 +81,7 @@ export function Column(props: ColumnProps) {
)}
</span>
)}
</Group>
</div>
{!props.width && <ColumnResizer className={resizerStyles} />}
</div>
))}
Expand Down
Loading