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

Improve focus highlight #2098

Closed
wants to merge 1 commit into from
Closed

Improve focus highlight #2098

wants to merge 1 commit into from

Conversation

LiamHD
Copy link

@LiamHD LiamHD commented Nov 13, 2016

The currently focused element (e.g. input field) is only hardly visible because the css files disable drawing of the outline. This is really bad for usability especially when using keyboard navigation (with the TAB key).

@mention-bot
Copy link

@LiamHD, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Henni, @jancborchardt and @MorrisJobke to be potential reviewers.

@MorrisJobke
Copy link
Member

cc @nextcloud/designers

@MorrisJobke MorrisJobke added 3. to review Waiting for reviews design Design, UI, UX, etc. labels Nov 14, 2016
@Espina2
Copy link
Contributor

Espina2 commented Nov 14, 2016

Can I see a print screen?

@LiamHD
Copy link
Author

LiamHD commented Nov 14, 2016

This is on google chrome on macOS

image

image

@jancborchardt
Copy link
Member

@LiamHD thank you for the improvement! :) The default outline was overridden because in lots of cases it’s visually unpleasant and inconsistent between systems and browsers. For many elements we do have hover/focus styles but inputs apparently not.

It would be good to keep it overridden but replace it with a proper style which looks nice and is consistent. Do you want to have a look at that? :)

@LiamHD
Copy link
Author

LiamHD commented Nov 14, 2016

@jancborchardt
Can you please provide examples where it is "visually unpleasant"? And on which browsers is it inconsistent? At least on chrome and safari on mac the defaults look very similar (light blow glow effect).

@eppfel
Copy link
Member

eppfel commented Nov 14, 2016

I agree with @jancborchardt that, instead of using the browser default, we should find a consistent style for this.

@LiamHD The glow color is actually the selection color set by the user in the system settings of Mac OS and therefore could yield some weird results. And Firefox on Mac does not have these outlines/glows. And that's just on Mac...

A quick and easy solution would be using the nextcloud accent color for the border. Buttons look odd, though.

nextcloud-input-focus

@LiamHD
Copy link
Author

LiamHD commented Nov 14, 2016

@eppfel: What is odd on the buttons?

@eppfel
Copy link
Member

eppfel commented Nov 14, 2016

@LiamHD They look like too similar to text inputs. And we don't use this button style...

Maybe changing the font-color helps:
button-focus

But personally I consider the grey buttons too minimalistic anyway:
button-redesign
But thats something for another issue...

@eppfel eppfel added 1. to develop Accepted and waiting to be taken care of help wanted and removed 3. to review Waiting for reviews labels Nov 14, 2016
@LiamHD
Copy link
Author

LiamHD commented Nov 14, 2016

whats the "nextcloud accent color"? Is that defined somewhere in the CSS?

@skjnldsv
Copy link
Member

@eppfel I like it!

@eppfel
Copy link
Member

eppfel commented Nov 14, 2016

@LiamHD It is the nextcloud blue by default, but can by set in the theming app. @juliushaertl to the rescue! 😁
...and with buttons we might want to distinguish :hover and :focus states. 🤔

@LiamHD
Copy link
Author

LiamHD commented Nov 15, 2016

I have some trouble changing the outline-color on safari.
See https://jsfiddle.net/LiamHD/15m22c1k/
This is working fine in chrome and in firebox, but safari still shows the blue outline color. Any ideas?

@LiamHD
Copy link
Author

LiamHD commented Nov 15, 2016

b540259 uses the nextcloud blue as outline-color. How does that theming work from a technical point of view? When I change the color in the theming settings the outline-color is not adapted at the moment.

@eppfel
Copy link
Member

eppfel commented Nov 15, 2016

@LiamHD Nice that you're trying to fix it. I just used the border-color in the mockups. I think outline is problematic.

The Theming App loads a CSS file generated with the custom color, that overwrites prior CSS properties. The CSS is generated in server/apps/theming/lib/Controller/ThemingController.php

@LiamHD
Copy link
Author

LiamHD commented Nov 15, 2016

Better with 9c02917 ?
So do I also have to adapt server/apps/theming/lib/Controller/ThemingController.php to also override the border-color?

eppfel
eppfel previously requested changes Nov 15, 2016
Copy link
Member

@eppfel eppfel 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 we should stick to the inputs and mabye buttons for now. Other opinions @nextcloud/designers ?

Should we choose 2px borders, we need to address the size glitches.

@@ -128,7 +129,7 @@ body {
max-width: 50%;
cursor: text;
background-color: #0082c9;
border: 1px solid rgba(255, 255, 255, .5);
border: 1px solid #0082c9;
Copy link
Member

Choose a reason for hiding this comment

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

This is searchbox in the header. And would remove the border, because it has the same color as the header.
bildschirmfoto 2016-11-15 um 19 16 36

Copy link
Author

Choose a reason for hiding this comment

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

Understood.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed with 6663dc4

@@ -2,7 +2,8 @@
This file is licensed under the Affero General Public License version 3 or later.
See the COPYING-README file. */

html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section { margin:0; padding:0; border:0; outline:0; font-weight:inherit; font-size:100%; font-family:inherit; vertical-align:baseline; cursor:default; }
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section { margin:0; padding:0; border:0; outline: 0; font-weight:inherit; font-size:100%; font-family:inherit; vertical-align:baseline; cursor:default; }
a:focus { color: #333; border: 2px solid #0082c9;}
Copy link
Member

Choose a reason for hiding this comment

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

This is a nice idea, but quite the change. And layout glitches, due to changes in border size.

focus-anquer

Copy link
Author

Choose a reason for hiding this comment

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

fixed with 6663dc4

#quota:focus,
.pager li a:focus {
color: #333;
border: 2px solid #0082c9;
Copy link
Member

@eppfel eppfel Nov 15, 2016

Choose a reason for hiding this comment

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

1px should be enough and more fitting. Also, changing the border-size, changes the size of the element, which creates layout glitches.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed with 6663dc4

@eppfel
Copy link
Member

eppfel commented Nov 15, 2016

@LiamHD We can address the theming in a next step.

@juliushaertl
Copy link
Member

@LiamHD Right, changes for the theming CSS go in apps/theming/lib/Controller/ThemingController.php but make sure those are also addressed in the unit tests at apps/theming/tests/Controller/ThemingControllerTest.php

@jancborchardt
Copy link
Member

@LiamHD is this ready by the way? We have Nextcloud 11 feature freeze this week. :)

Please review @nextcloud/accessibility @nextcloud/designers

@eppfel
Copy link
Member

eppfel commented Nov 18, 2016

There are a lot of unclean effects right now:


bildschirmfoto 2016-11-16 um 22 37 46


bildschirmfoto 2016-11-16 um 22 37 28


bildschirmfoto 2016-11-16 um 22 36 52


I would really advise to limit this PR to text inputs and maybe buttons. It would be an improvement, without breaking other stuff (to my knowledge). These rules could easily added to theming app.

@LiamHD To finally merge this PR you have to sign your commits and best would be, if you could squash them to one commit.

So,...

  1. finalize changes
  2. squash commits
  3. sign the commit
  4. push force

If you need more help with this, let me know. We might have to open on new branch in the nextcloud/server repository.

@jancborchardt jancborchardt modified the milestone: Nextcloud 12.0 Nov 18, 2016
@LiamHD
Copy link
Author

LiamHD commented Nov 21, 2016

I added the "select:focus" style.
In a second commit I also added support for the theming. I hope I understood the styling-stuff correctly.

@@ -347,6 +347,16 @@ public function getStylesheet() {
'opacity: 0.4;' .
'color: '.$textColor.';'.
"}\n";

$responseCss .= 'input[type="text"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="tel"]:focus, input[type="url"]:focus, input[type="time"]:focus, input[type="date"]:focus, textarea:focus, select:focus, button:focus, .button:focus, input[type="submit"]:focus, input[type="button"]:focus, #quota:focus, .pager li a:focus { '.
' color: #333; '.
Copy link
Member

Choose a reason for hiding this comment

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

I think this line is obsolete, because it is set to #333 already.

input[type="button"]:focus,
#quota:focus,
.pager li a:focus {
color: #333;
Copy link
Member

Choose a reason for hiding this comment

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

Now, that I look again why is this needed anyway. Isn't this the default?

Copy link
Author

Choose a reason for hiding this comment

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

You mean the color: #333;? Yes that could be. The important part is the following:border: 1px solid #0082c9;
I was not sure if I have to repeat the color: #333;.

Copy link
Member

Choose a reason for hiding this comment

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

There is rule in place already, so yeah, I think it's obsolete:
bildschirmfoto 2016-11-21 um 16 25 35

@eppfel
Copy link
Member

eppfel commented Nov 21, 2016

Works on my side. Just the minor thing with this color: #333 , maybe there is a reason for this, that i don't see.

@eppfel
Copy link
Member

eppfel commented Nov 21, 2016

Ah, and now we have to adjust the tests. 🐝 Totally forgot about that. But the signing worked 🎉
server/apps/theming/tests/Controller/ThemingControllerTest.php

@LiamHD
Copy link
Author

LiamHD commented Nov 21, 2016

@eppfel : I did have a look at the tests you mentioned but did not understand them. What needs to be adapted there?
Should I remove the color: #333 ?

@eppfel
Copy link
Member

eppfel commented Nov 22, 2016

@LiamHD Yes, removing color: #333 would save a line of code and a CSS rule to render.

I only changed one nextcloud unit test so far, so no expert either. But to me, it looks like the four functions that fail, check if the generated CSS is as expected. Because we change the CSS, we have to adapt what the test have to expect.
So, I think we just have to add the additional CSS rules to the tests:

  • testGetStylesheetWithOnlyColor
  • testGetStylesheetWithOnlyColorInvert
  • testGetStylesheetWithAllCombined
  • testGetStylesheetWithAllCombinedInverted

See: https://github.com/nextcloud/server/blob/master/apps/theming/tests/Controller/ThemingControllerTest.php#L437

Still happy to help..

@LiamHD
Copy link
Author

LiamHD commented Nov 22, 2016

Okay. Now I have removed the unnecessary color rule.
Also the test are fixed.
@eppfel : Thanks for you help.

@codecov-io
Copy link

codecov-io commented Nov 22, 2016

Current coverage is 57.01% (diff: 100%)

Merging #2098 into master will increase coverage by <.01%

@@             master      #2098   diff @@
==========================================
  Files          1192       1192          
  Lines         71649      71655     +6   
  Methods        7293       7293          
  Messages          0          0          
  Branches       1212       1212          
==========================================
+ Hits          40849      40856     +7   
+ Misses        30800      30799     -1   
  Partials          0          0          
Diff Coverage File Path
•••••••••• 100% apps/theming/lib/Controller/ThemingController.php

Powered by Codecov. Last update df21562...99005eb

@eppfel
Copy link
Member

eppfel commented Nov 22, 2016

Hey, we did it. Glad to help. You could squash and force push again...
LGTM

@eppfel eppfel added 3. to review Waiting for reviews enhancement and removed 1. to develop Accepted and waiting to be taken care of help wanted labels Nov 22, 2016
Signed-off-by: Matthias Becker <becker.matthias@gmail.com>
@jancborchardt
Copy link
Member

jancborchardt commented Nov 22, 2016

@LiamHD @eppfel since we just had feature freeze and this has the potential for breakage, I’d be more confident if we wait with merging this until we have stable11 branched off. I’ll schedule this for Nextcloud 12 then, where we can get it in with the beginning of the development cycle so there’s plenty of time to test. :)
Is that OK with you?

@jancborchardt jancborchardt added this to the Nextcloud 12.0 milestone Nov 22, 2016
@LiamHD
Copy link
Author

LiamHD commented Dec 13, 2016

Any progress here?

Copy link
Member

@LukasReschke LukasReschke left a comment

Choose a reason for hiding this comment

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

Master is free for merges again. I didn't really test this intensively but @jancborchardt statement above indicates that this should be good to go in.

Jan, please give this a final review and either decide to merge or not merge. Thanks.

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Works nicely except for HTML selects. The text of the items in the dropdown is colored according to the themed color. This works with dark ones, but bright ones make it impossible to read.
Tested with FF on Linux

@MorrisJobke MorrisJobke added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Dec 22, 2016
@MorrisJobke
Copy link
Member

Hey @LiamHD could you check the issue that @ChristophWurst noticed? Thanks :)

@LiamHD
Copy link
Author

LiamHD commented Jan 5, 2017

@ChristophWurst: What would you propose to fix the issue?

@@ -347,6 +347,15 @@ public function getStylesheet() {
'opacity: 0.4;' .
'color: '.$textColor.';'.
"}\n";

$responseCss .= 'input[type="text"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="tel"]:focus, input[type="url"]:focus, input[type="time"]:focus, input[type="date"]:focus, textarea:focus, select:focus, button:focus, .button:focus, input[type="submit"]:focus, input[type="button"]:focus, #quota:focus, .pager li a:focus { '.
Copy link
Member

Choose a reason for hiding this comment

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

@LiamHD we could exclude selects here

@eppfel eppfel mentioned this pull request Jan 20, 2017
@eppfel
Copy link
Member

eppfel commented Jan 22, 2017

Obsolete due to #3187

@eppfel eppfel closed this Jan 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress design Design, UI, UX, etc. enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet