cnvs icon indicating copy to clipboard operation
cnvs copied to clipboard

Buttons cannot have display: flex in some browsers (Safari, notably)

Open jfurrow opened this issue 9 years ago • 6 comments

http://stackoverflow.com/questions/35464067/flexbox-not-working-on-button-element-in-some-browsers

We need to remove display: flex on button elements.

jfurrow avatar Jan 06 '17 23:01 jfurrow

~~When we make this change, we must also set the line-height of the buttons so that the text is centered vertically.~~ Nevermind, we don't need to set the line-height.

jfurrow avatar Jan 06 '17 23:01 jfurrow

Here's the fix I applied in DC/OS: https://github.com/dcos/dcos-ui/pull/1750

jfurrow avatar Jan 07 '17 00:01 jfurrow

@jfurrow I'm having a difficult time replicating this in Safari.

ashenden avatar Jan 09 '17 23:01 ashenden

@ashenden Check out this pen in Safari, it illustrates the problem we encountered in DC/OS UI: http://codepen.io/yeahjohnnn/pen/XpbaWm

jfurrow avatar Jan 10 '17 00:01 jfurrow

Ah. But with text-align:center we can solve that. The bigger one that I can't seem to solve is the dropdown arrow :after element in FF. I have a half-ass fix for this here -- https://github.com/mesosphere/cnvs/pull/84

ashenden avatar Jan 10 '17 01:01 ashenden

text-align: center works because Safari's not rendering the element with flex layout.

The dropdown's :after element in FF is a symptom of the same issue. If you change the button to an a or div it will render as expected.

I suggest we remove display: inline-flex and display: flex for button elements because it's not well supported. If we need flex containers inside buttons, we'll have to rely on a nested element.

jfurrow avatar Jan 10 '17 01:01 jfurrow