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

Fixing high contrast bugs from issue #3102 #3301

Merged

Conversation

kristoferbrown
Copy link
Contributor

Pull request checklist

Description of changes

Resolves high contrast bugs in

  • ChoiceGroup
  • PeoplePicker
  • SwatchColorPicker
  • Dropdown
  • Persona
  • ColorPicker
  • PrimaryButton
  • MessageBar
  • Detailslist Check
  • Toggle
  • ProgressIndicator
  • Spinner

@kristoferbrown
Copy link
Contributor Author

@micahgodbolt, I'd love for you to take a look at what I did in Button to make sure I'm handling the ccs in js/theming stuff right.

@lynamemi, I think you mentioned wanting to see how high contrast stuff works, so here's a PR with several changes. 99% of it is using @include high-contrast to target HC mode in Edge, changing some colors to system color names, and then maybe setting -ms-high-contrast-adjust: none if text has weird unexpected backgrounds.

@@ -24,7 +24,6 @@ export class ButtonAnchorExample extends React.Component<IButtonProps, {}> {
href='http://bing.com'
target='_blank'
title='Let us bing!'
style={ { color: '#ffffff' } }
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this looks totally out of place, but I added this in because UHF in the website overrides our link styles. Maybe there is just a better way to go about it? Is it causing a HC issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed it because we're changing the HC primary button style to black on white and this override made it white on white. I'm not seeing any issue with it in non-HC mode after removing this line, so I think it should be OK to remove now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Unfortunately the non-HC mode issue only shows up when we deploy the website. The local build doesn't have the UHF. Maybe you can test the live site in the browser to double check it's ok to remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah ok, that makes sense. Seems like it's still in issue. I'll come up with another way to fix this HC issue without regressing on the issue you fixed and then let you know.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome, thank you! I'll stay tuned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lynamemi, I think we can sidestep this whole issue by just making this example button not primary. Let me know if you see any issue with that approach.

Also, the Persona/ActivityItem issue we saw this morning should be fixed in this PR now.

Copy link
Collaborator

@lynamemi lynamemi Nov 7, 2017

Choose a reason for hiding this comment

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

Very good point! That change to standard and the updates for activity item look good to me!

@phkuo
Copy link
Contributor

phkuo commented Nov 6, 2017

@kristoferbrown did you investigate fixing the HTML first to be semantically correct for each of these? This only fixes these for IE/Edge, and I understand we can't get it perfect on FireFox since we lack these selectors, but we should still encourage semantically correct HTML over messy media queries.

@kristoferbrown
Copy link
Contributor Author

@phkuo, I'll do another pass over all of the changes in this PR and see if any of these fixes can be replaced with HTML changes.

@kristoferbrown
Copy link
Contributor Author

@phkuo, I skimmed over all the files changed in this PR and didn't find any of the fixes that could be accomplished just by changing the HTML. Everything in this PR is handling a weird edge case to begin with, so all these media queries are needed to fix them.

@kristoferbrown
Copy link
Contributor Author

@phkuo, any chance you could take another look at this PR so we can get it out the door?

selectors: {
'.ms-Persona-imageArea': {
marginTop: '-2px',
border: '2px solid #fff',
Copy link
Contributor

Choose a reason for hiding this comment

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

this needs to use a themed color

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been changed to theme.palette.white

@@ -1,6 +1,8 @@
import { IButtonStyles } from './Button.Props';
import { ITheme } from '../../Styling';

const MS_HIGHCONTRAST_ACTIVE = '@media screen and (-ms-high-contrast: active)';
Copy link
Contributor

Choose a reason for hiding this comment

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

this const should be in a shared file somewhere, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good timing on this, David just added this to CommonStyles. I've changed over every other instance of this to use the one defined there.

[MS_HIGHCONTRAST_ACTIVE]: {
color: 'Window',
backgroundColor: 'WindowText',
MsHighContrastAdjust: 'none'
Copy link
Contributor

Choose a reason for hiding this comment

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

if we actually need this, it's really bad practice, we shouldn't be having usage-necessary images being background images. this is something we can definitely do by tweaking the HTML, or using a :before

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@phkuo, I'm not sure what the issue is here, there is no background image. The idea is just that primary buttons should use a background color instead of a border like normal buttons. Can you clarify what you'd like to see changed here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't -ms-high-contrast-adjust:none used to show the background image? If yes, see previous comment.

If it's only used so that the background color shows, then shouldn't setting background color directly (as is already done here) be sufficient?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

-ms-high-contrast-adjust affects a few different things as well. Namely, it turns off the Window colored highlight that Edge (but not IE) gives all text. It's invisible most of the time, but any time there is an intentional background color or the text is close to other elements it covers things up.

Without setting it here, things like this happen.
capture

@kristoferbrown kristoferbrown merged commit 067363f into microsoft:master Nov 17, 2017
ohritz pushed a commit to ohritz/office-ui-fabric-react that referenced this pull request Dec 5, 2017
* High contrast fixes: choiceGroup, persona, suggestions, commandbar example

* Increasing visibilty of focus border on choice group elements.

* picker selected item high contrast improvements

* Removing swatchColorPicker high contrast borders

* Primary button, dropdown, and colorPicker contrast adjustments

* Details check, message bar x button, progress, spinner, and toggle HC updates

* rush change

* Build fixes

* Fixing persona/activityItem border issues

* Changing achor button example to a non-primary button

* Using non-deprecated defaultButton

* changing compact border to palette color

* Removing high-contrast const definitions from all style ts files
chrismohr pushed a commit to chrismohr/office-ui-fabric-react that referenced this pull request Apr 17, 2018
* High contrast fixes: choiceGroup, persona, suggestions, commandbar example

* Increasing visibilty of focus border on choice group elements.

* picker selected item high contrast improvements

* Removing swatchColorPicker high contrast borders

* Primary button, dropdown, and colorPicker contrast adjustments

* Details check, message bar x button, progress, spinner, and toggle HC updates

* rush change

* Build fixes

* Fixing persona/activityItem border issues

* Changing achor button example to a non-primary button

* Using non-deprecated defaultButton

* changing compact border to palette color

* Removing high-contrast const definitions from all style ts files
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

High contrast issues in components
4 participants