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

ListItem with rightIconButton of element containing RaisedButton doesn't apply button style or swallow clicks #1688

Closed
jyasskin opened this issue Sep 21, 2015 · 3 comments
Labels
bug 🐛 Something doesn't work

Comments

@jyasskin
Copy link

Apply the following diff to the material-ui examples:

diff --git a/examples/browserify-gulp-example/src/app/components/main.jsx b/examples/browserify-gulp-example/src/app/components/main.jsx
index 394e990..3d3e2b8 100644
--- a/examples/browserify-gulp-example/src/app/components/main.jsx
+++ b/examples/browserify-gulp-example/src/app/components/main.jsx
@@ -4,9 +4,17 @@ let React = require('react');
 let mui = require('material-ui');
 let RaisedButton = mui.RaisedButton;
 let Dialog = mui.Dialog;
+let List = mui.List;
+let ListItem = mui.ListItem;
 let ThemeManager = new mui.Styles.ThemeManager();
 let Colors = mui.Styles.Colors;

+let ButtonWrapper = React.createClass({
+  render() {
+    return <RaisedButton label="Its Button" onTouchTap={()=>alert('Button pressed')}/>;
+  }
+})
+
 let Main = React.createClass({

   childContextTypes: {
@@ -38,18 +46,21 @@ let Main = React.createClass({

     return (
       <div style={containerStyle}>
-        <Dialog
-          title="Super Secret Password"
-          actions={standardActions}
-          ref="superSecretPasswordDialog">
-          1-2-3-4-5
-        </Dialog>
-
         <h1>material-ui</h1>
         <h2>example project</h2>

-        <RaisedButton label="Super Secret Password" primary={true} onTouchTap={this._handleTouchTap} />
-
+        <List>
+          <ListItem
+            primaryText="A Working Item"
+            rightIconButton={<RaisedButton label="Its Button" onTouchTap={()=>alert('Button pressed')}/>}
+            onTouchTap={()=>alert('Item pressed')}
+            />
+          <ListItem
+              primaryText="A Broken Item"
+              rightIconButton={<ButtonWrapper/>}
+              onTouchTap={()=>alert('Item pressed')}
+              />
+              />
+        </List>
       </div>
     );
   },

And you'll get the following rendering (in Mac Chrome 47):

Screenshot showing button in wrong place

Even on the "working" list item, the button isn't vertically centered in the item, but in the broken item, the button doesn't get the "move to the right" style at all", and clicks on the button activate the list item's onTouchTap also instead of being swallowed as the rightIconButton documentation says it should be.

@alitaheri alitaheri added the bug 🐛 Something doesn't work label Dec 8, 2015
@abellee
Copy link

abellee commented Jan 31, 2016

Is this fixed?
also IconButton does.

@tintin1343
Copy link
Contributor

This seems to be resolved in the documentation website. Closing this.

@jlroettger
Copy link

See #3959. This strange behavior still occurs when rightIconButton is set to certain components instead of an element (as was the case for @jyasskin). It looks like it does work for components in some instances though

mnajdova pushed a commit to mnajdova/material-ui that referenced this issue Nov 10, 2020
Bumps eslint-plugin-pretty-imports from 1.0.2 to 1.1.3.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

No branches or pull requests

5 participants