Skip to content

Commit

Permalink
fix(Table): fix table cell text cannot be copied
Browse files Browse the repository at this point in the history
* added a list of arrowKeys, added a check for only required events in onScrollByKeydown function.

* formatted code

---------

Co-authored-by: Vishal Joshi <[email protected]>
  • Loading branch information
yourvishal007 and vishalSasTech authored Oct 26, 2023
1 parent 42496fc commit 8a9f06b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/useScrollListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const momentumTimeThreshold = 300;
// Inertial sliding start vertical distance threshold
const momentumYThreshold = 15;

//List of Arrow Keys for scrolling through keys
const arrowKeysList = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];

interface ScrollListenerProps {
rtl: boolean;
data: readonly RowDataType[];
Expand Down Expand Up @@ -506,7 +509,7 @@ const useScrollListener = (props: ScrollListenerProps) => {

const onScrollByKeydown = useCallback(
(event: React.KeyboardEvent) => {
if (event.currentTarget === event.target) {
if (event.currentTarget === event.target && arrowKeysList.indexOf(event.key) > -1) {
event.preventDefault();
const step = 40;

Expand Down

1 comment on commit 8a9f06b

@vercel
Copy link

@vercel vercel bot commented on 8a9f06b Oct 26, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.