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

fix: Prevent default action when clicking the postpone button #2513

Merged
merged 2 commits into from Dec 19, 2023

Conversation

Cito
Copy link
Contributor

@Cito Cito commented Dec 17, 2023

Description

When clicking the "postpone" button (a feature introduced in version 5.3.0), then the default behavior of the associated click event should be suppressed.

Motivation and Context

If the task query appears in a callout, then clicking the postpone button will also trigger opening the callout for editing. This default behavior appears in addition to the desired behavior of postponing the task and is not expected to happen.

Moreover, when right-clicking the button, in addition to the postpone-context-menu, the default context menu for editing the callout will also appear on top of it. This PR fixes this problem as well. The default menu now only appears when right-clicking the callout outside of the postpone button.

Fixes #2512

How has this been tested?

  • Manual testing
  • Obsidian 1.5.0 and Tasks 5.3.0
  • using the markdown shown in the issue

Types of changes

Changes visible to users:

  • Bug fix (prefix: fix - non-breaking change which fixes an issue)
  • New feature (prefix: feat - non-breaking change which adds functionality)
  • Breaking change (prefix: feat!! or fix!! - fix or feature that would cause existing functionality to not work as expected)
  • Documentation (prefix: docs - improvements to any documentation content for users)
  • Sample vault (prefix: vault - improvements to the Tasks-Demo sample vault)
  • Contributing Guidelines (prefix: contrib - any improvements to documentation content for contributors - see Contributing to Tasks)

Internal 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)
  • Infrastructure (prefix: chore - examples include GitHub Actions, issue templates)

Checklist

Terms

@claremacrae claremacrae added the scope: user interface Changes to parts of UI other the Edit task modal. See also "scope: edit task" label Dec 17, 2023
@claremacrae
Copy link
Collaborator

Crikey, that was quick.

I've edited the description to the following, so GitHub will auto-close the issue when this is merged... so that I don't have to remember to do that...

Fixes #2512

@claremacrae
Copy link
Collaborator

Will review as soon as I have time...

@Cito
Copy link
Contributor Author

Cito commented Dec 17, 2023

I have now extended the scope a bit to also cover right-clicks in addition to the left-clicks.

@claremacrae claremacrae added the display: live preview Issues referring to Obsidian's Live Preview mode label Dec 19, 2023
@claremacrae
Copy link
Collaborator

Moreover, when right-clicking the button, in addition to the postpone-context-menu, the default context menu for editing the callout will also appear on top of it. This PR fixes this problem as well. The default menu now only appears when right-clicking the callout outside of the postpone button.

Testing the behaviour before the fix, I cannot reproduce the above.

For me, on Mac, in Live Preview, right-clicking on the Postpone button only shows the postpone menu.

@claremacrae
Copy link
Collaborator

Just to note that my understanding of this comment in #2517 suggests that this code may be changed later...

But I'm merging this PR anyway, as it is a definite improvement in behaviour, and also it exists.

@claremacrae claremacrae merged commit 449ebf5 into obsidian-tasks-group:main Dec 19, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
display: live preview Issues referring to Obsidian's Live Preview mode scope: user interface Changes to parts of UI other the Edit task modal. See also "scope: edit task"
Projects
Status: 🎉 Released
Development

Successfully merging this pull request may close these issues.

Postponing a task from inside a callout should not edit the view [in Live Preview]
2 participants