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!!: Use similar styling for Edit and Postpone buttons #2562

Merged

Conversation

Cito
Copy link
Contributor

@Cito Cito commented Jan 7, 2024

Description

This PR addresses issue #2517.

The problem here was that the "edit" and "postpone" buttons were created and styled very differently - one as an anchor element with an image mask to show the pencil icon and the other one as a button with a fixed unicode "fast forward" char as context.

Because of these difference, the two buttons had a different look (one faint text color, the other one colorful) and needed different CSS to style them. The hard-coded "fast forward" character was also difficult to change using CSS.

This PR changes the code and CSS file so that both buttons are created in a similar way, can be styled in a similar way, and both have a similar colorful look by default using unicode characters. The unicode characters used for the content of the buttons are not hard-coded, but can be modified using CSS.

I decided to use an anchor tag for both buttons because it can be styled more easily and with less interference by the browser, though a button might be more correct semantically.

You can change the used unicode character simply by changing the CSS content property, but it is also still possible to style the buttons using an image mask and setting the content to an empty string.

How has this been tested?

Manual testing on Windows 11.

Made sure that it looks ok and that using the buttons for tasks in a callout also works as expected.

Screenshots (if appropriate)

postpone-and-edit

Types of changes

This change may break existing CSS snippets used to style the postpone and edit button.

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

@Cito Cito mentioned this pull request Jan 7, 2024
7 tasks
@claremacrae
Copy link
Collaborator

@Cito Huge thanks for picking this up...

Can I please check:

  • Can you confirm that any custom CSS written on the pencil icon previously will still work, unchanged... I don't want to have to bump to 6.0.0 with a breaking change...
  • And does anything need to be updated in the Styling docs?

@claremacrae
Copy link
Collaborator

Oh wait, I see you have labelled it as a breaking change, so I did not need to ask...

I'm happy for the styling of Postpone to change - as that is what was requested in the other issue.

Sorry, but I'm not happy to change the Pencil styling though...

@claremacrae
Copy link
Collaborator

claremacrae commented Jan 7, 2024

If you still wanted to change the Pencil styling, then I trust your experience of the benefit ...

Here is how I have documented breaking changes previously:
https://publish.obsidian.md/tasks/Support+and+Help/Breaking+Changes

So please could this PR include corresponding documentation similar to what was done in 3.0.0 - highlighting the change, and telling people how they should edit their CSS to retain their previous customisations...

Thank you.

@claremacrae claremacrae added the scope: css styling Changes to styling of elements displayed by Tasks, including search results and individual tasks label Jan 7, 2024
@Cito
Copy link
Contributor Author

Cito commented Jan 7, 2024

Ok, I can explain in the docs how to get the old look of the pencil back and to change the style of the fast forward button to unicolor as well. This will help those who really preferred the old look and at the same time give an example how to generally change the style. May take a few days since a busy work week is ahead, but it's on my list for this week.

Btw, there are also two copies of the styles.css file (I think used for example and doc vaults) - should I adapt these as well or is there some automatism that copies the latest version over anyway?

@claremacrae
Copy link
Collaborator

Ok, I can explain in the docs how to get the old look of the pencil back and to change the style of the fast forward button to unicolor as well.

Brilliant - thank you very much.

This will help those who really preferred the old look and at the same time give an example how to generally change the style.

Thank you.

May take a few days since a busy work week is ahead, but it's on my list for this week.

OK.

Btw, there are also two copies of the styles.css file (I think used for example and doc vaults) - should I adapt these as well or is there some automatism that copies the latest version over anyway?

Just change the one in the root... Periodically I use 'Update Plugins' in the sample vault to update it to the latest... (There's an issue for automating that process #2367 )

@claremacrae
Copy link
Collaborator

You probably know this, but in the new docs, just put in X.Y.Z as a placeholder for the next version number.

@Cito
Copy link
Contributor Author

Cito commented Jan 8, 2024

@claremacrae I have added the requested documentation now

@claremacrae claremacrae changed the title Use similar styling for edit and postpone buttons fix!!: Use similar styling for edit and postpone buttons Jan 9, 2024
@claremacrae claremacrae changed the title fix!!: Use similar styling for edit and postpone buttons fix!!: Use similar styling for Edit and Postpone buttons Jan 9, 2024
@claremacrae
Copy link
Collaborator

On my Mac (Sonoma), the tasks-buttons-alt.css snippet looks like this:

image

The docs say it looks like this:

image

@claremacrae
Copy link
Collaborator

The docs say it looks like this:

image

I wonder if the vault had customised the icons for the date emojis when the screenshots were made? I don't recognise that date icon.

@claremacrae
Copy link
Collaborator

Thank you very much indeed for adding the docs and the CSS samples, @Cito.

I had a quick experiment, planning to just merge it before taking some new screenshots and to include this in the next release....

It looks like I will need to recreate the screenshots in this PR before release though... and first I need to understand why the alt one differs - and then test the other snippets...

So I will do all this after the imminent release.

@Cito
Copy link
Contributor Author

Cito commented Jan 9, 2024

@claremacrae I made the screenshots on Windows 11. Just tested on a Mac. It seems the "alt" characters are not implemented as glyphs on MacOs, probably since they were introduced only in Unicode 7. The default characters for edit and postpone are from Unicode 6 and work on MacOs and Android (just double-checked).

I will add a remark that character glyphs (emojis) can look slightly different or not be supported on different platforms.

@claremacrae
Copy link
Collaborator

Thank you.

@Cito
Copy link
Contributor Author

Cito commented Jan 9, 2024

Ok, added some remarks in 0931a33 now.

@Cito
Copy link
Contributor Author

Cito commented Jan 9, 2024

Btw, on this page you can see how the calendar icons appears on different devices.

@claremacrae
Copy link
Collaborator

Just to say that I haven't forgotten about this... Getting sort by function good enough for release is taking much longer than I naively expected...

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.

Hi @Cito, many thanks for this.

I really like the new options for button style.

No action needed on these comments from you - they are for me.

I've read through the changes... The notes added here are reminders of things for me to do after I've merged...

I will merge main in to your branch and resolve the conflicts, and then go ahead and merge the PR.

docs/How To/How to style buttons.md Show resolved Hide resolved
docs/How To/How to style buttons.md Show resolved Hide resolved
docs/How To/How to style buttons.md Show resolved Hide resolved
docs/How To/How to style buttons.md Show resolved Hide resolved
docs/How To/How to style buttons.md Show resolved Hide resolved
docs/How To/How to style buttons.md Show resolved Hide resolved
docs/How To/How to style buttons.md Show resolved Hide resolved
# Conflicts:
#	tests/ui/Menus/PostponeMenu.test.ts
@Cito
Copy link
Contributor Author

Cito commented Jan 17, 2024

Thanks a lot for caring, @claremacrae

@claremacrae claremacrae merged commit 1873b8e into obsidian-tasks-group:main Jan 17, 2024
1 check passed
@claremacrae
Copy link
Collaborator

It's too late now, but looking at the default styling I only now noticed the horizontal alignment of the bottom of buttons.

(Funny the things I don't notice until I use them with data I am actually working on, rather than purely testing....)

image

@claremacrae
Copy link
Collaborator

It's also entirely possible that the previous code was similarly aligned and I just never looked closely...

@Cito
Copy link
Contributor Author

Cito commented Jan 17, 2024

I can take a look at the vertical alignments of everything if you think it's worth fixing. Just create a new dedicated issue linking to this comment and tag me. This does not need to hold up the next release.

@Cito Cito deleted the edit-and-postpone-button-style branch February 4, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: css styling Changes to styling of elements displayed by Tasks, including search results and individual tasks
Projects
Status: 🎉 Released
Development

Successfully merging this pull request may close these issues.

None yet

2 participants