Material-ui: [EnhancedButton] Should not apply type="button" when not rendering a <button> element

Created on 15 Apr 2016  路  15Comments  路  Source: mui-org/material-ui

Problem Description

to reproduce error, update normalize.css from 3.0.3 to "4.1.1". See image below. You'll notice that ListItems inside a LeftNav/Drawer look strange.

https://www.dropbox.com/s/nv1lxfac7fiamfy/Screenshot%202016-04-15%2014.03.43.png?dl=0

Versions

  • Material-UI: 0.15.0-beta.1
  • React:15.0.1
  • Browser: Chrome 50.0.2661.75 (64-bit)
bug 馃悰

Most helpful comment

@jokeyrhyme it worked for me too but if you use linkButton on a button, it doesn't work. You also need to add a[type=button]

span[type=button] {
  appearance: none;
}
a[type=button] {
  appearance: none;
}

All 15 comments

It seems to happen with materialize-css version 4.0.0 too

it's all because of this:

image

"material-ui": "^0.15.0-beta.1"
https://cdnjs.cloudflare.com/ajax/libs/normalize/4.1.1/normalize.min.css
Chrome Version 50.0.2661.75 (64-bit)

This is because the links in that list are span elements -- which is totally incorrect.

I think https://github.com/callemall/material-ui/pull/3953 might fix this in the docs -- not the core issue though

Is there a workaround on this? It is still a problem when using material-ui v0.15.0 with normalize 4.x. Between IE11/Firefox/Chrome, only Chrome has this problem, so is this actually a bug that should be lodged with normalize?

In necolas/normalize.css#554, this exact issue was brought up and their position is:

The usage of <span type="button"> is not valid HTML.

My workaround for now is <ListItem ... style={{"-webkit-appearance": "none"}} />

I guess there's a couple options:

  • remove default of type: 'button' from EnhancedButton's defaultProps, but we want other button types such as reset and submit.
  • adding "-webkit-appearance": "none" to the default styles.

What breaks when EnhancedButton uses <button> or <input> instead of <span> as its basis?

Adding {"-webkit-appearance": "none"} results in warning, instead we can use { WebkitAppearance: "none" }.

It feels dodgy, but I've just got a workaround in my global CSS (using autoprefixer):

span[type=button] {
  appearance: none;
}

Doesn't seem to have broken anything (yet). :)

This helps me:

span[type=button]
  appearance: none
  -webkit-appearance: none

@jokeyrhyme it worked for me too but if you use linkButton on a button, it doesn't work. You also need to add a[type=button]

span[type=button] {
  appearance: none;
}
a[type=button] {
  appearance: none;
}

Just spent a good 30 minutes trying to figure it out. Can we have an official fix for this? It is really annoying.

+1, chased this bug for an hour. Does anything break if we remove type="button"?

any update?

this bug also appear when using Normalize 5.0.0 馃槶

I'm using Eric Meyer's reset and it works fine. normalize or sanitize no good. 馃槶
http://meyerweb.com/eric/tools/css/reset/

We have been porting the component on the v1-beta branch. We reimplemented it from the ground-up. While we haven't tested it, I think that the issue is most likely fixed on that branch. Hence, I'm closing it.
Still, we will accept PR fixes until v1-beta takes over the master branch.

Was this page helpful?
0 / 5 - 0 ratings