Skip to content

Button: Focus in high contrast mode fix#4221

Merged
lynamemi merged 16 commits intomicrosoft:masterfrom
lynamemi:button-focus-hc
Mar 16, 2018
Merged

Button: Focus in high contrast mode fix#4221
lynamemi merged 16 commits intomicrosoft:masterfrom
lynamemi:button-focus-hc

Conversation

@lynamemi
Copy link
Copy Markdown
Collaborator

@lynamemi lynamemi commented Mar 9, 2018

Pull request checklist

Description of changes

Button focus wasn't working in high contrast mode. To fix this, I refactored getFocusStyle to take a highContrastStyle object that defines focus style in high contrast mode. CommandBarButton has a different style than the rest.

I debated about putting more logic inside getFocusStyle, but landed on passing a generic IRawStyle object for more flexibility.

In High Contrast White:
image
image
image
image
image

Focus areas to test

I tested that focus still works in non high contrast.

Copy link
Copy Markdown
Member

@betrue-final-final betrue-final-final left a comment

Choose a reason for hiding this comment

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

Much better.

inset: number = 0,
position: 'relative' | 'absolute' = 'relative'
position: 'relative' | 'absolute' = 'relative',
highContrastStyle: IRawStyle | undefined = undefined
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a difference between this and just "IRawStyle?"?

Copy link
Copy Markdown
Collaborator Author

@lynamemi lynamemi Mar 9, 2018

Choose a reason for hiding this comment

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

Probably not different, but I am getting a tslint error if I don't have the extra bits when I rush rebuild:
missing-optional-annotation Argument following optional argument missing optional annotation: highContrastStyle: IRawStyle

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can see why it needs to be IRawStyle or undefined, but do you need to set the default to undefined? isn't that what it'll be if it's not set?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Alas, that's part of what triggers the error I noted above.

@lynamemi
Copy link
Copy Markdown
Collaborator Author

bump for this PR. we're getting more issues reported for this bug.

Copy link
Copy Markdown
Member

@micahgodbolt micahgodbolt left a comment

Choose a reason for hiding this comment

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

If ben is good with the high contrast, the I'm fine. If you can clean up that function just a bit great, but not stopping this PR.

inset: number = 0,
position: 'relative' | 'absolute' = 'relative'
position: 'relative' | 'absolute' = 'relative',
highContrastStyle: IRawStyle | undefined = undefined
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I can see why it needs to be IRawStyle or undefined, but do you need to set the default to undefined? isn't that what it'll be if it's not set?

@lynamemi
Copy link
Copy Markdown
Collaborator Author

@phkuo Any more feedback?

@lynamemi lynamemi closed this Mar 15, 2018
@lynamemi lynamemi reopened this Mar 15, 2018
@yaananth
Copy link
Copy Markdown
Member

yaananth commented Mar 15, 2018

High contrast black theme the background of the selected button (which should be similar to focus) should be in "Cyan" and button text should be in "Black" colour.

In white theme background colour should be in "Purple" and button text colour should be in "White".

Are we doing that here? From description, it doesn't look like it.

.......(edited):
Is that not the case? Is there a standard somewhere for web? We can argue that focusing a button is in a way selecting the button, if it's just focus, border would suffice, but should we honor select styles as well? Do we have a definitive guidance here?

@lynamemi
Copy link
Copy Markdown
Collaborator Author

@yaananth, this PR is just for button focus in high contrast mode. I worked with our designer, @betrue-final-final. If it's another high contrast bug you're seeing, please file a separate issue.

@yaananth
Copy link
Copy Markdown
Member

@lynamemi That's where the confusion is, how do we distinguish focus vs selection for a button in web world? Is there a defintitive guidance here?

consider VS:
image

focusing, adopts "select" styles.
If we follow that, then focus should render "Select" styles for buttons in web.

@betrue-final-final
Copy link
Copy Markdown
Member

Focus is a border and there is no selected button state. It’s either rest or hover or pressed.

@lynamemi lynamemi merged commit b4f58e4 into microsoft:master Mar 16, 2018
@lynamemi lynamemi deleted the button-focus-hc branch March 16, 2018 17:13
@yaananth
Copy link
Copy Markdown
Member

Thanks @betrue-final-final as long as everyone across org is considering the same, sounds good!

@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.

Accessibility issue - buttons

5 participants