Skip to content

Conversation

@mohitbagra
Copy link

@mohitbagra mohitbagra commented Jan 25, 2018

Pull request checklist

Description of changes

The current alignment of focus outline around BaseButton is making the outline invisible in IE11. Fixed the issue by incrementing the inset by 1px in BaseButton styles.

Focus areas to test

Tested other areas of the application to verify that changes did not affect other portions of the application. Also tested the fix in major browsers (Chrome, FF, Edge, IE11)

@micahgodbolt
Copy link
Member

I'm a bit concerned of the visual affect this will have on the majority of our users to support a small percentage of them. Can you include screenshots of buttons before/after this change? It seems our visual regression tests aren't capturing focused states.

@betrue-final-final
Copy link
Member

yes, please. Ideally we get a snapshot, but a screenshot here would be good.

@micahgodbolt
Copy link
Member

I believe the change to -1 outline was intentional. and I wouldn't want to undermine the purpose for which that was done. Might be high contrast mode related as well.

@mohitbagra
Copy link
Author

Chrome:
image
image
image

IE11
image
image
image

Edge:
image
image
image

Firefox:
image
image
image

@mohitbagra
Copy link
Author

The issue doesnt repro at https://developer.microsoft.com/en-us/fabric#/components/button
because this site has a non-fabric css rule added -
button {
overflow: visible;
}

Due to this overflow rule, the outline border is visible even in IE11. So if my current fix is not acceptable, how about adding this overflow rule in BaseButton?

@betrue-final-final
Copy link
Member

Those screenshots don't look right. There are one too many outlines...that blue or grey one on the outside shouldn't be there. It looks like the focus rectangle and margin are getting shrunk by 1px all around.

@micahgodbolt
Copy link
Member

micahgodbolt commented Jan 26, 2018 via email

@mohitbagra
Copy link
Author

This is on chrome:
Before my fix:
image

After the fix:
image

I agree that in non IE browser the outline will be little thicker, but without this fix, IE is showing no focus outline.
This is how it looks in IE before this fix -
image
image
image

@micahgodbolt
Copy link
Member

TADA! IE11 button defaults to overflow: hidden, whereas chrome/ff/edge default to overflow: visible

image

Sounds like the safest bet is to just specify overflow:visible for our buttons. We should probably communicate this pretty well, as anyone that expected an overflow:hidden to work with just a single class selector, might see their code break.

@mohitbagra
Copy link
Author

@micahgodbolt
So should we add this rule just in BaseButton styles or to all buttons, like this -
.ms-Fabric button {
overflow: visible
}

(Add this rule in fabric.css)

I assume this issue would not just be scoped to baseButton, so we should add this rule to fabric css file to all buttons under ms-Fabric

@betrue-final-final
Copy link
Member

@micahgodbolt, does this fix the issue without the visual regression? We can't break the other, supported and active browsers for this fix.

@betrue-final-final betrue-final-final self-requested a review January 26, 2018 19:22
@mohitbagra
Copy link
Author

@micahgodbolt . You are right. If I add overflow: hidden to button in non-IE browsers, they start to show this issue too.

@mohitbagra
Copy link
Author

@betrue-final-final Since all non-IE browsers (I tested Chrome, Edge and Firefox) already have "overflow: visible" for buttons by default and fabric is not overriding them right now, adding this rule in fabric css wont cause any regressions in non IE browsers.
This rule should only fix this issue in IE and not break any other browser. So I suggest we add this in fabric css-

.ms-Fabric button {
overflow: visible
}

@micahgodbolt
Copy link
Member

micahgodbolt commented Jan 26, 2018

My only other thought would be to add the style to our Fabric component, and apply it just like MWF did, to the button. That way any .foo {overflow:hidden} will override the style. @mikewheaton @battletoilet - thoughts on adding this browser compat style to <Fabric>

@micahgodbolt
Copy link
Member

we want the fix to be as low specificity as possible to avoid breaking downstream users

@mohitbagra
Copy link
Author

@micahgodbolt @mikewheaton @battletoilet - Any thoughts?
If we do want to add this overflow style to Fabric, can you point me to the file where I need to add this change?

@micahgodbolt
Copy link
Member

my vote is putting it into the Fabric component as it is not a style specific to our buttons, it is a browser consistency concern. i.e. I don't want any global styles in the button component, but I also don't want this style to have the specificity of a class.

@mohitbagra
Copy link
Author

Any idea where do I make this change? I think the css would look like -
.ms-Fabric button {
overflow: visible
}

@betrue-final-final
Copy link
Member

The current fix still messes up the focus rectangle in other browsers.
image

@micahgodbolt
Copy link
Member

we really don't want to drop this style into .ms-Fabric button, as that specificity will break anyone using only a className. I know many instances where users needed to remove overflow, and I bet this would break them. We might get away with just .ms-Button, but even that could break some downstream users.

@micahgodbolt
Copy link
Member

micahgodbolt commented Jan 29, 2018 via email

@mohitbagra mohitbagra closed this Feb 13, 2018
@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.

Focus outline not visible for BaseButton in IE11

3 participants