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

refactor: extract label generation for Edit Task modal #2822

Conversation

ilandikov
Copy link
Collaborator

Description

Sorry for a big PR =) I can split it into several ones if needed.

  • remove CSS class accesskey-first and unify access key declaration with accesskey class
  • remove HTML elements declaring access keys from the modal without access keys
    • Somehow they were still in the <label> elements O_o
    • They were not present in <input> elements which inhibited the access keys
  • extract editTaskLabelContent() function to generate the label content
    • use it everywhere except priority (there the content is different and linked with CSS styles, so no gain for now)
  • for dependencies and dates, move <label> to <Dependency> and <DateEditor> component respectively

Motivation and Context

  • Move HTML code generation inside the components (for <Dependency> and <DateEditor>)
  • Prepare to extract Svelte components (for other Task fields/future components)

How has this been tested?

Unit test made possible with thanks to a previous PR with @claremacrae

Manual test at the end of the refactoring:

  • Verify that access keys are not working when disabled in Settings
  • Verify that each access key focuses its field in the modal when enabled in Settings

Types of changes

  • Refactor (prefix: refactor - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)
  • Tests (prefix: test - additions and improvements to unit tests and the smoke tests)

Checklist

  • My code follows the code style of this project and passes yarn run lint.
  • My change has adequate Unit Test coverage.
    • Couple of commits in CSS code make me say no to this

Terms

Only the snapshot without the access keys is impacted
Only the snapshot without the access keys is impacted
…sskey-first

Also tested manually in demo vault - each access key worked
<form> doesnt need the optional class anymore, since this is managed by withAccessKeys variable only
@claremacrae claremacrae added scope: edit task The Create or edit task modal/dialog type: internal Only regards development or contributing labels May 13, 2024
@ilandikov
Copy link
Collaborator Author

Added jsdocs and refactored a bit =) No more pushes, ready for review =)

@claremacrae
Copy link
Collaborator

Hi @ilandikov,

I started doing a review and then saw you're still pushing.

That's absolutely fine - could you just let me know when it's ready for review please?

@claremacrae
Copy link
Collaborator

Hi @ilandikov,

I started doing a review and then saw you're still pushing.

That's absolutely fine - could you just let me know when it's ready for review please?

Cancel that - I've just seen your comment...

@claremacrae
Copy link
Collaborator

Thanks... I've given this a once over, but it's too big to review in one evening. Since it exists, I don't think there's any point you doing it all over again, and I would likely have the same comments...

I'll review my draft comments on Tuesday, or worst case, Wednesday evening, and get back to you...

@ilandikov
Copy link
Collaborator Author

The trajectory of this PR is quite linear, so splitting it into several PR is pretty straightforward. Are you sure you don’t want me to do this?)

or you can see it this way - the only functionality I’m touching are the access keys. They work as expected, so the main questions is “is the state of the code better now?”

@claremacrae
Copy link
Collaborator

The trajectory of this PR is quite linear, so splitting it into several PR is pretty straightforward. Are you sure you don’t want me to do this?)

or you can see it this way - the only functionality I’m touching are the access keys. They work as expected, so the main questions is “is the state of the code better now?”

OK, that's a helpful comment.

In that case, I'll go ahead and submit my comments after a first half hour or so of reviewing just on GitHub...

Then you'll have time to address anything you care to, and my next run through the code might be a little easier...

Copy link
Collaborator

@claremacrae claremacrae left a comment

Choose a reason for hiding this comment

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

Thank you for this.

Here are some thoughts after a first read through...

src/ui/EditTask.svelte Outdated Show resolved Hide resolved
src/ui/EditTaskHelpers.ts Outdated Show resolved Hide resolved
src/ui/EditTaskHelpers.ts Show resolved Hide resolved
src/ui/EditTaskHelpers.ts Outdated Show resolved Hide resolved
src/ui/EditTask.svelte Show resolved Hide resolved
src/ui/DateEditor.svelte Outdated Show resolved Hide resolved
@claremacrae claremacrae merged commit 2cb345e into obsidian-tasks-group:main May 14, 2024
1 check passed
@claremacrae
Copy link
Collaborator

Thanks!

@ilandikov
Copy link
Collaborator Author

Thanks a lot for your review! Let's discuss the details this WE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: edit task The Create or edit task modal/dialog type: internal Only regards development or contributing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants