Skip to content
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

TableView cosmetic fixes from testing session #3560

Merged
merged 2 commits into from
Sep 28, 2022
Merged
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
4 changes: 2 additions & 2 deletions packages/@adobe/spectrum-css-temp/components/menu/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ governing permissions and limitations under the License.

& .spectrum-Menu-sectionHeading {
/* Support headings as LI */
margin-block-start: var(--spectrum-menu-margin-x);
margin-block-end: var(--spectrum-menu-margin-x);
margin-block-start: var(--spectrum-global-dimension-size-75);
margin-block-end: var(--spectrum-global-dimension-size-40);
}

&:focus {
Expand Down
13 changes: 7 additions & 6 deletions packages/@adobe/spectrum-css-temp/components/table/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,10 @@ svg.spectrum-Table-sortedIcon {
.spectrum-Table-columnResizer {
display: flex;
position: absolute;
/* -9 aligns us with already existing cell dividers inside the table itself */
inset-inline-end: -9px;
inset-inline-end: -10px;
justify-content: center;
box-sizing: border-box;
inline-size: 20px;
inline-size: 21px;
block-size: 100%;
user-select: none;

Expand Down Expand Up @@ -430,10 +429,10 @@ svg.spectrum-Table-sortedIcon {

.spectrum-Table-colResizeIndicator {
display: none;
height: calc(100% + 1px);
height: 100%;
width: 2px;
position: absolute;
top: 0;
top: 1px;
inset-inline-end: 0;
pointer-events: none;
&.spectrum-Table-colResizeIndicator--visible {
Expand All @@ -443,7 +442,9 @@ svg.spectrum-Table-sortedIcon {
.spectrum-Table-colResizeNubbin {
display: none;
position: absolute;
top: 0px;
/* svg top pixel is anti-aliased, this lets through the blue bar in the background, so we move the bar
down one pixel and the nubbin circle up one pixel to cover it completely */
top: -1px;
width: 16px;
height: 16px;
inset-inline-start: -7px;
Expand Down
11 changes: 6 additions & 5 deletions packages/@react-spectrum/table/src/TableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -581,14 +581,13 @@ function TableColumnHeader(props) {
}

let _TableColumnHeaderButton = (props, ref: FocusableRef<HTMLDivElement>) => {
let {focusProps, ...otherProps} = props;
let {isEmpty} = useTableContext();
let domRef = useFocusableRef(ref);
let {buttonProps} = useButton({...props, elementType: 'div', isDisabled: isEmpty}, domRef);
let {buttonProps} = useButton({...otherProps, elementType: 'div', isDisabled: isEmpty}, domRef);
return (
<div className={classNames(styles, 'spectrum-Table-headCellContents')}>
<FocusRing focusRingClass={classNames(styles, 'focus-ring')}>
<div className={classNames(styles, 'spectrum-Table-headCellButton')} {...buttonProps} ref={domRef}>{props.children}</div>
</FocusRing>
<div className={classNames(styles, 'spectrum-Table-headCellButton')} {...mergeProps(buttonProps, focusProps)} ref={domRef}>{props.children}</div>
</div>
);
};
Expand Down Expand Up @@ -616,6 +615,7 @@ function ResizableTableColumnHeader(props) {
if (columnProps.width && columnProps.allowsResizing) {
throw new Error('Controlled state is not yet supported with column resizing. Please use defaultWidth for uncontrolled column resizing or remove the allowsResizing prop.');
}
let {isFocusVisible, focusProps} = useFocusRing();

const onMenuSelect = (key) => {
switch (key) {
Expand Down Expand Up @@ -679,6 +679,7 @@ function ResizableTableColumnHeader(props) {
'is-sorted-desc': state.sortDescriptor?.column === column.key && state.sortDescriptor?.direction === 'descending',
'is-sorted-asc': state.sortDescriptor?.column === column.key && state.sortDescriptor?.direction === 'ascending',
'is-hovered': isHovered,
'focus-ring': isFocusVisible,
'spectrum-Table-cell--hideHeader': columnProps.hideHeader
},
classNames(
Expand All @@ -692,7 +693,7 @@ function ResizableTableColumnHeader(props) {
)
}>
<MenuTrigger>
<TableColumnHeaderButton ref={triggerRef}>
<TableColumnHeaderButton ref={triggerRef} focusProps={focusProps}>
{columnProps.hideHeader ?
<VisuallyHidden>{column.rendered}</VisuallyHidden> :
column.rendered
Expand Down