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: highlighted cell synced background #181

Merged
merged 3 commits into from
Sep 20, 2022

Conversation

Birkbjo
Copy link
Member

@Birkbjo Birkbjo commented Sep 18, 2022

Fixes some styling issues with highlighted field. Previously, the !important keyword on highlighted-field prevented invalid and synced styles from being applied to the highlighted field when this was unfocused.
I think we want the white-background when editing the field - and this is now done by using the .active-selector, which is in my opinion more correct than using the highlighted-field-selector.

Highlighted-synced unfocused:

image

Before:
image

Highlighted-synced focused:
(same as before)
image

Highlighted-error unfocused:

image

Before:
image

@@ -38,10 +45,11 @@
background: var(--colors-grey300);
}

.invalid:not(.highlighted) {
.invalid:not(.active) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Using the highlighted-selector prevented the highlighted-but-unfocused cell to not show the red-background.

@dhis2-bot
Copy link
Contributor

dhis2-bot commented Sep 18, 2022

🚀 Deployed on https://pr-181--dhis2-data-entry.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify September 18, 2022 14:22 Inactive
@Birkbjo Birkbjo requested review from HendrikThePendric, KaiVandivier and tomzemp and removed request for HendrikThePendric September 18, 2022 14:48
@dhis2-bot dhis2-bot temporarily deployed to netlify September 19, 2022 07:08 Inactive
Copy link
Contributor

@HendrikThePendric HendrikThePendric left a comment

Choose a reason for hiding this comment

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

I think the changes you have made here and the rationale behind them are correct. So we can go ahead and merge this in. This visual bug was a regression from #142 where I introduced the highlighted cell state for cells without focus.

Whilst testing the branch via the PR link, I noticed a few odd things in this cell UI. I'm pretty sure they weren't introduced in this PR, but might be something for @cooper-joe to consider....

Below is a cell into which I first entered a valid value, which was then synced. I then changed the value to a string which is invalid. Now the cell is "synced and errored". Technically correct, but users will get confused....
Screenshot 2022-09-19 at 09 25 56
Perhaps here we should hide the sync indicator? (Not sure...)

And below is that same "synced and errored" cell again, but now I have focussed the input. In this case we have a cell with an invalid value, and we have a tooltip above which indicates why the value is invalid. However, since there is no red color, and we're even seeing some green from the sync indicator, I don't think the user can see very easily that this cell is invalid right now...
Screenshot 2022-09-19 at 09 29 10
Perhaps it would make sense to show a red outline in this case?

@Birkbjo
Copy link
Member Author

Birkbjo commented Sep 19, 2022

@HendrikThePendric

I've a PR up to fix some of the conflicting cell-states you are seeing here #182 . This simply resets the "synced"-status whenever the value changes. I think that makes sense, since now the value does not match the last synced value.

However, since there is no red color, and we're even seeing some green from the sync indicator, I don't think the user can see very easily that this cell is invalid right now...

I think it is intentional that the current focused field should not show a red background, atleast that was my understanding from the css, and I implemented the same behaviour here. However, we could maybe change the outline to red in that case?
However, as Lars mentioned in the slack today:

I generally don't like validation which kicks in before the user is even given a chance to do the right thing in the form.

I think this is about the same - we do show the tooltip above, but we don't show a glaring red-field until the user focuses another field, and I think we should keep that behaviour so we don't shout at the user before they have a chance to do the correct thing.

Copy link
Member

@tomzemp tomzemp left a comment

Choose a reason for hiding this comment

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

Looks good!

It does make me wonder if we should also reset the highlightedFieldID if they click outside the cell? (separate issue)

@HendrikThePendric
Copy link
Contributor

It does make me wonder if we should also reset the highlightedFieldID if they click outside the cell? (separate issue)

No because then we don't see the highlighted cell anymore when interacting with the sidebar.

@Birkbjo Birkbjo force-pushed the fix/highlighted-cell-synced-background branch from d853339 to a3dc51c Compare September 19, 2022 21:47
@dhis2-bot dhis2-bot temporarily deployed to netlify September 19, 2022 21:51 Inactive
@cooper-joe
Copy link
Member

Below is a cell into which I first entered a valid value, which was then synced. I then changed the value to a string which is invalid. Now the cell is "synced and errored". Technically correct, but users will get confused....

Perhaps here we should hide the sync indicator? (Not sure...)

Yeah, I think hiding the sync indicator makes sense here. The invalid value is not synced, so a sync indicator is false signal.

However, since there is no red color, and we're even seeing some green from the sync indicator, I don't think the user can see very easily that this cell is invalid right now...

Perhaps it would make sense to show a red outline in this case?

The cell did have a red border/outline before the user focused it. I think showing the user that they have focused the cell is important, as they will hopefully already be aware of the error state from the tooltip and previous red background/outline. In isolation, it looks confusing, but I'm thinking it'll be clear in the context of using the app for real data entry.

@Birkbjo Birkbjo force-pushed the fix/highlighted-cell-synced-background branch from a3dc51c to a20f882 Compare September 20, 2022 12:24
@dhis2-bot dhis2-bot temporarily deployed to netlify September 20, 2022 12:26 Inactive
@Birkbjo Birkbjo merged commit 87d1479 into development Sep 20, 2022
Birkbjo added a commit that referenced this pull request Sep 25, 2022
* fix(cell): fix synced background for highlighted cell

* fix: fix highlighted styling

* fix: minor cleanup
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.

5 participants