fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Possible bug, <Nav /> gives wrong behavior on *icon* and *onClick* attrs

Open Aaron2Ti opened this issue 9 years ago • 5 comments

Bug Report

  • Package version(s): "office-ui-fabric-react": "^4.30.0"
  • Browser and OS versions: Chrome 60

Priorities and help requested (not applicable if asking question):

Are you willing to submit a PR to fix? (Yes, No)

Requested priority: (Blocking, High, Normal, Low) Normal

Products/sites affected: (if applicable)

Describe the issue:

        <Nav
            groups={
                [
                    {
                        links:
                        [
                            {
                                name: 'Home',
                                icon: 'Edit',
                                url: '',
                                links: [{
                                    name: 'Activity',
                                    url: '',
                                    icon: 'Edit',
                                    key: 'key1'
                                },
                                {
                                    name: 'News',
                                    url: '',
                                    onClick: (e) => {},
                                    icon: 'Edit',
                                    key: 'key2'
                                }],
                                isExpanded: true
                            },
                        ]
                    }
                ]
            }
            selectedKey={ 'key1' }
        />

Actual behavior:

  1. The first menu 'Activity' has no icon.
  2. The second menu is highlighted(selected).

Expected behavior:

  1. The first menu 'Activity' has a mail icon.
  2. The second menu should not be highlighted(selected).

Aaron2Ti avatar Aug 16 '17 09:08 Aaron2Ti

screen shot 2017-08-16 at 5 43 08 pm

Aaron2Ti avatar Aug 16 '17 09:08 Aaron2Ti

I did a bit of investigation. All of these issues arise from the unresolved differences between _renderAnchorLink and _renderButtonLink.

_renderAnchorLink does not observe the icon property, which is why it doesn't show up for Activity in your repro

_renderButtonLink uses CommandButton, whereas _renderAnchorLink "rolls its own" for styling, and the two are not in sync. The CommandButton styles are what's rendering "News" in the themePrimary color.

As a separate issue, I'm not sure of the design intention when rendering items with and without icons side-by-side; whether we want to keep the text aligned with each other, or have the current effect you see in the repro.

If @mikewheaton or another Fabric designer can clarify the design intent of this component, I can resolve the differences highlighted in this bug one way or another.

MLoughry avatar Oct 04 '17 20:10 MLoughry

@MLoughry thanks a lot for your reviewing

Aaron2Ti avatar Oct 05 '17 14:10 Aaron2Ti

@Aaron2Ti Nav has had some refactoring and I can't repro this bug anymore. I'm going to go ahead and close this issue, please reopen if you continue to experience issues with it

erichdev avatar Oct 26 '17 23:10 erichdev

@erichdev thanks a lot

Aaron2Ti avatar Oct 27 '17 01:10 Aaron2Ti