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

Prevent closed Menu from being selectable #913

Merged
merged 1 commit into from
Jun 24, 2015
Merged

Prevent closed Menu from being selectable #913

merged 1 commit into from
Jun 24, 2015

Conversation

CumpsD
Copy link
Contributor

@CumpsD CumpsD commented Jun 22, 2015

When a menu is closed, the opacity is set to 0. The height is set to 0 as well. However, due to padding top and bottom being 8, there as a 16px high invisible section present on the screen, which was selectable (the first menu item would get clicked)

To fix this, we need to remove the padding if it is in closed mode.

When a menu is closed, the opacity is set to 0. The height is set to 0 as well. However, due to padding top and bottom being 8, there as a 16px high invisible section present on the screen, which was selectable (the first menu item would get clicked)

To fix this, we need to remove the padding if it is in closed mode.
@CumpsD
Copy link
Contributor Author

CumpsD commented Jun 22, 2015

For information, right now I solved this without changing material-ui code by doing:

    componentDidMount() {
        this._fixMenuVisibilityBug();
    }

    componentDidUpdate() {
        this._fixMenuVisibilityBug();
    }

    _fixMenuVisibilityBug() {
        var avatarMenuVisible = this.props.avatarMenuVisible;
        log('Fixing up avatar menu visibility bug.', avatarMenuVisible);
        var el = React.findDOMNode(this.refs.avatarMenu);
        if (avatarMenuVisible) {
            el.style.paddingTop = Spacing.desktopGutterMini + 'px';
            el.style.paddingBottom = Spacing.desktopGutterMini + 'px';
        } else {
            el.style.paddingTop = '0px';
            el.style.paddingBottom = '0px';
        }
    }

@hai-cea
Copy link
Member

hai-cea commented Jun 24, 2015

Thanks @CumpsD !

hai-cea added a commit that referenced this pull request Jun 24, 2015
Prevent closed Menu from being selectable
@hai-cea hai-cea merged commit e8a3fa3 into mui:master Jun 24, 2015
@CumpsD CumpsD deleted the patch-2 branch June 24, 2015 18:03
@zannager zannager added the component: menu This is the name of the generic UI component, not the React module! label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants