Skip to content

Conversation

@Neeraj-gagat
Copy link
Contributor

Description

This Pr adds shortcuts for taskdialog
now we can naigate through task feilds using up && down arrow keys and
and by enter you can edit the feild
by escape yo can exit the editing state or by pressing escape when you are not editing anything you can exit dialog

- Fixes: #319

Additional Notes

will raise other pr for addtask dialog

video

Screencast.from.04-01-26.08.01.11.AM.IST.webm

let me know if i need to do any changes

@github-actions
Copy link

github-actions bot commented Jan 4, 2026

Thank you for opening this PR!

Before a maintainer takes a look, it would be really helpful if you could walk through your changes using GitHub's review tools.

Please take a moment to:

  • Check the "Files changed" tab
  • Leave comments on any lines for functions, comments, etc. that are important, non-obvious, or may need attention
  • Clarify decisions you made or areas you might be unsure about and/or any future updates being considered.
  • Finally, submit all the comments!

More information on how to conduct a self review:
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request

This helps make the review process smoother and gives us a clearer understanding of your thought process.

Once you've added your self-review, we'll continue from our side. Thank you!

Copy link
Contributor Author

@Neeraj-gagat Neeraj-gagat left a comment

Choose a reason for hiding this comment

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

added shortcuts keys to use in taskdialog
like up down arrow keys enter to go in edit mode
escape to exit edit mode when edit mode for one feild is open you can not open anot edit mode
and if you press escape when edit feild is not ope you can exit diaog but when edit feild is open you can exit edit feild

Copy link
Contributor Author

@Neeraj-gagat Neeraj-gagat left a comment

Choose a reason for hiding this comment

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

done with the self review new chages break nothing all the test pass and it works fine
let me know if i need to make chnages

@Neeraj-gagat
Copy link
Contributor Author

Hey @its-me-abhishek while working on this feat I tried to add shortcuts to calender so we can use arrow keys to navigate through dates and select them but it did not work out do you have any suggestions how can I do that ?

Copy link
Collaborator

@its-me-abhishek its-me-abhishek left a comment

Choose a reason for hiding this comment

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

Also, do rename the PR title, old commits, as per the naming conventions in CONTRIBUTING.MD

import { formattedDate, handleCopy } from './tasks-utils';
import { useEffect, useRef, useState } from 'react';

const FIELDS = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be moved to constants.ts file

'annotations',
] as const;

type FieldKey = (typeof FIELDS)[number];
Copy link
Collaborator

Choose a reason for hiding this comment

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

similarly, move this to types.ts

const focusedField = FIELDS[focusedFieldIndex];

useEffect(() => {
const el = editButtonRef.current[focusedField];
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does el suggest? should be renamed to a better variable name, which should be self explanatory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was shortform for element i think this is self explanatory if you want i can make it element let me know

Copy link
Collaborator

Choose a reason for hiding this comment

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

element would be better in this case

});
}, [focusedField]);

const focusMap: Record<string, () => void> = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this map should be extracted out, as a task-utils function if possible. They will end up bloating the TaskDialog component finally. Making it harder to change

target.tagName === 'INPUT' ||
target.tagName === 'TEXTAREA' ||
target.isContentEditable;
// ⛔ allow normal typing
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do remove these comments

editState.isEditingAnnotations,
]);

const handleDialogKeyDown = (e: React.KeyboardEvent) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe this can be abstracted out as well

};

const saveAndExit = (fn: () => void) => {
fn();
Copy link
Collaborator

Choose a reason for hiding this comment

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

fn shall be renamed as well

});
};

const handledropdown = (type: FieldKey) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

similar, should be moved to a utils file

t.uuid
)}
readOnly
tabIndex={-1}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why's this -1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was to prevent default focus but we dont actually need it will remove it in new chnages

@Neeraj-gagat
Copy link
Contributor Author

Also, do rename the PR title, old commits, as per the naming conventions in CONTRIBUTING.MD

On it 👍

@Neeraj-gagat Neeraj-gagat changed the title Feat/extend shortcuts feat:extend-shortcuts Jan 5, 2026
Copy link
Collaborator

@its-me-abhishek its-me-abhishek left a comment

Choose a reason for hiding this comment

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

Please also add unit tests for all these new files/changes

inputRefs,
}: UseTaskDialogFocusMapProps<F>) {
return React.useCallback(
(field: F[number]) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please revert to verbose variable names here as well. they usually lose context and become hard to guess over the time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I did not get it what do I exactly need to do add type for fields or something else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@its-me-abhishek can you please clear my doubt

Copy link
Collaborator

Choose a reason for hiding this comment

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

hi, i just meant, change this (and all other vars) to better names as you'd done here earlier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahh okkokk my bad changing it now

}

export interface UseTaskDialogKeyboardProps<F extends readonly string[]> {
fields: F;
Copy link
Collaborator

Choose a reason for hiding this comment

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

here as well

isOverdue,
isUnsynced,
}: EditTaskDialogProps) => {
const editButtonRef = useRef<Record<FieldKey, HTMLButtonElement | null>>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

if possible, replace all any to a data type. for typesafe code and easier tests

@Neeraj-gagat
Copy link
Contributor Author

Hey @its-me-abhishek can you please clear my. doubt. About reverting changes ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more keyboard shortcuts using hotkeys

2 participants