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

[Table] Newly focused cell after keyboard navigation is now transformed #2988

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion packages/table/src/interactions/selectable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import { IRegion, Regions } from "../regions";
import { DragEvents } from "./dragEvents";
import { Draggable, ICoordinateData, IDraggableProps } from "./draggable";

export type ISelectedRegionTransform = (region: IRegion, event: MouseEvent, coords?: ICoordinateData) => IRegion;
export type ISelectedRegionTransform = (
region: IRegion,
event: MouseEvent | KeyboardEvent,
coords?: ICoordinateData,
) => IRegion;

export interface ISelectableProps {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/table/src/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ export class Table extends AbstractComponent<ITableProps, ITableState> {
const { selectedRegionTransform } = this.props;
const transformedSelectionRegions =
selectedRegionTransform != null
? newSelectionRegions.map(region => selectedRegionTransform(region, undefined))
? newSelectionRegions.map(region => selectedRegionTransform(region, e))
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have ICoordinateData for the third argument? perhaps newFocusedCell? (i'm not looking at the code actively)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ICoordinateData is defined in src/interactions/draggable.tsx and it seems to hold data that is relevant only for dragging gestures. The only time when this argument is used at the moment is in handleDragMove() in src/interactions/selectable.tsx. I would say that it is not relevant here.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice thank you

: newSelectionRegions;
this.handleSelection(transformedSelectionRegions);
this.handleFocus(newFocusedCell);
Expand Down